difference between aggregate ($match) and find, in MongoDB? -


what difference between $match operator used inside aggregate function , regular find in mongodb?

why doesn't find function allow renaming field names aggregate function? e.g. in aggregate can pass following string:

{ "$project" : { "ordernumber" : "$purchaseorder.ordernumber" , "shipdate" : "$purchaseorder.shipdate"}} 

whereas, find not allow this.

why not aggregate output return dbcursor or list? , why can't count of documents returned?

thank you.

why not aggregate output return dbcursor or list?

the aggregation framework created solve easy problems otherwise require map-reduce.

this framework commonly used compute data requires full db input , few document output.

what difference between $match operator used inside aggregate function , regular find in mongodb?

one of differences, stated, return type. find operations output return dbcursor.

other differences:

and why can't count of documents returned?

you can. count number of elements in resulting array or add following command end of pipe:

{$group: {_id: null, count: {$sum: 1}}} 

why doesn't find function allow renaming field names aggregate function?

mongodb young , features still coming. maybe in future version we'll able that. renaming fields more critical in aggregation in find.

edit (2014/02/26):

mongodb 2.6 aggregation operations return cursor.

edit (2014/04/09):

mongodb 2.6 released predicted aggregation changes.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -