Is it possible to use aggregate function after the find function in MongoDB? I want to query a document and then aggregate according to find result.
db.movies.find({"runtime":30},{runtime:1,year:1,"imdb.rating":1,"imdb.votes":1,type:1,"tomatoes.viewer.rating":1,"awards.wins":1}).limit(3).aggregate([{$group:{_id:"$runtime",award_wins:{$sum:1}}}])
After executing this command I am getting an error that, aggregate is not a function,
E QUERY [js] TypeError: db.movies.find(...).limit(...).aggregate is not a function :