我的现状是 知道mongodb 的写法,但项目用的是mongoose,怎么办 ?
我的想法是 把mongoose的model 转为 对应的 collection 然后 直接用mongodb的 方法。
下面是mongodb 的写法。 我目前知道 mongoose 的 model叫AAA
db.people.aggregate( [ { $match: { "name": "Tanya Jordan" } }, { $graphLookup: { from: "people", startWith: "$friends", connectFromField: "friends", connectToField: "name", as: "golfers", restrictSearchWithMatch: { "hobbies" : "golf" } } }, { $project: { "name": 1, "friends": 1, "connections who play golf": "$golfers.name" } } ] )
待解决
悬赏分:0
- 离问题结束还有
点赞 0反对 0举报 0
收藏 0
分享 3
