Reputation: 96
This is the code not working.
Model.aggregate([{ "$match": query }]).explain(true);
Upvotes: 4
Views: 3247
Reputation: 415
Adding ,{ explain: true }
after the aggregation array into a MyModel.aggregate(array, options)
type of statement didn't work for me in Mongoose 5.2.7 / MongoDB 3.6.6. Luckily, MyModel.aggregate(array).explain()
is now available and documented https://mongoosejs.com/docs/api.html#aggregate_Aggregate-explain
Upvotes: 2