MongoDB QueryData

From mi-linux
Revision as of 21:45, 18 October 2016 by Cm1958 (talk | contribs) (Created page with " Show all data so far: db.deptCollection.find() Comes back messy, can make it better: db.deptCollection.find().pretty() Or just find one document: db.deptCollection.fi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Show all data so far:

db.deptCollection.find()

Comes back messy, can make it better:

db.deptCollection.find().pretty()

Or just find one document:

db.deptCollection.find({"deptno":10}).pretty()

Finding an employee means using the array name too:

db.deptCollection.find({"employees.empno":7902}).pretty()

However, does mean you get back all the employees!