Your SlideShare is downloading. ×
0
Mongo db readingdocumentusecases
Mongo db readingdocumentusecases
Mongo db readingdocumentusecases
Mongo db readingdocumentusecases
Mongo db readingdocumentusecases
Mongo db readingdocumentusecases
Mongo db readingdocumentusecases
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Mongo db readingdocumentusecases

44

Published on

Visit …

Visit
http://www.zariga.com
http://www.youtube.com/user/zarigatongy

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
44
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. MongoDB Reading/findingDocumentReading/finding Document Use Casedetailed
  • 2. Reading/finding in DocumentSyntaxdb.collection.find( <query>,<projection> )<query> argument corresponds tothe WHERE statement, and<projection> argument correspondsto the list of fields to select from theresult set.
  • 3. findOne()Find the first record in the document> db.user.findOne(){"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"),"date" : ISODate("2013-03-10T11:30:50.555Z"),"remarks" : [{"name" : "anish","rate" : "good"},{"name" : "nath","rate" : "bad"}],"uName" : "anish"}
  • 4. findOne() : specify which key to return• Find the first record in the document and return only “_id”> db.user.findOne({},{"_id":1}){ "_id" : ObjectId("513c6ef1cfce9090d3fd8b1d") }• Find the first record in the document and return only“_id” and date> db.user.findOne({},{"_id":1,"date":1}){"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"),"date" : ISODate("2013-03-10T11:30:50.555Z")}• Find the first record in the document and return all thedata except the “_id” field> db.user.findOne({},{"_id":0}){"date" : ISODate("2013-03-10T11:30:50.555Z"),"remarks" : [{"name" : "anish","rate" : "good"},{"name" : "nath","rate" : "bad"}],"uName" : "anish"}
  • 5. finding in Subdocument>db.user.find({"remarks.name":"anish" }){ "_id" :ObjectId("513c6ef1cfce9090d3fd8b1d"),"date" : ISODate("2013-03-10T11:30:50.555Z"), "remarks" : [ {"name" : "anish", "rate" : "good" }, {"name" : "nath", "rate" : "bad" } ],"uName" : "anish" }
  • 6. findOne()/find()• Summary on <K,boolean>specify <“k”,0> or <“K”,1>to show/hide data to bereturned from thecollection
  • 7. Thanks for Watchingfeedbackappreciated…………………………

×