Closed Aeonrush closed 8 years ago
When I tried to use mongoose-fill with aggregation
mongoose-fill
aggregation
require('mongoose').model('Art').aggregate([ {$lookup: { from: 'likes', localField: '_id', foreignField: 'art', as: 'likes' }}, {$sort: {_id: -1}}, ]).fill('likesCount').exec(callback);
I got an error
TypeError: require(...).model(...).aggregate(...).fill is not a function at router.get
When I write
require('mongoose').model('Art').find({}).fill('likesCount').exec(callback);
all works fine I think monggose-fill not designed for work in this scenario?
monggose-fill
Yes I think that is because mongoose aggregate is just a wrapper for native aggregate which is not supposed to always return documents, but something else projected.
aggregate
Thanks a lot 😄
When I tried to use
mongoose-fill
withaggregation
I got an error
When I write
all works fine I think
monggose-fill
not designed for work in this scenario?