MongoDB: Is it possible to limit the results of $lookup to certain fields (as a projection)?
- 阅读更多 关于 MongoDB: Is it possible to limit the results of $lookup to certain fields (as a projection)?
问题 Here is some code, guys. db.collection('bugs').aggregate([{ $match: finder }, { $sort: { name: 1 } }, { $limit: startrecord + settings.pagination_limit }, { $skip: startrecord }, { $lookup: { from: 'users', localField: 'user', foreignField: '_id', as: 'user' } }], { collation: collation }, function(err, docs) { It works perfectly, it's a plain lookup. However I only need a few fields from the collection "users", and the $lookup returns everything. Is there a way to apply a projection to the