在填充NodeJs MongoDB之后获取数据

这是我的模式 enter image description here

我有这样的人口查询

 let population = [{model: Customer,path: 'customer'},{model: Role,path: 'role',select: 'user',populate: {model: User,path: 'user'}}]

此查询的结果是这样的

 "data": [
            {
                "isactive": false,"created_at": "2020-01-20T07:57:36.251Z","_id": "5e255e7fe560893f0c30f9ce","code": "4","name": "DISTRIBUTOR 1","contact": "ronald","phone": 812117562425,"email": "info@test.com","tipe": "A","__v": 0,"customer": null,"role": {
                    "_id": "5e255e96e560693f1c30f2cf","distributor_id": "5e255e2fe522083f0c30f9ce","user": {
                        "isactive": false,"last_login": "2020-01-21T02:15:55.073Z","superUser": false,"_id": "5e255fb6e560893f0c30f9d0","role_id": "5e255e96e560893f0c30f9cf","name": "yogi","description": "Admin1"

我的问题是,如何在一个分发服务器中仅从每个角色获取用户数据?

jidushijie 回答:在填充NodeJs MongoDB之后获取数据

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2741946.html

大家都在问