MongodbChamps
Sunday, March 29, 2015
M102: MONGODB FOR DBAS - Homework 1.4
Step 1:
Check all the query in mongodb shell
Step 2:
you will observe that it is giving sorted result for
i) var c = db.products.find({}).sort({name:1}); c.forEach( function(doc){ print(doc.name) } );
ii)
var c = db.products.find({},{name:1,_id:0}).sort({name:1}); while( c.hasNext() ) print( c.next().name);
i.e 1 & 2
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment