How to retrieve array value from mongoDB -
i have data in mongodb
"emp_id" : "1000", "emp_name" : "jim", "department" : [  {      "department_id" : 1,      "contacts" : [      {         "mobile" : 102,         "phone" : "1",      }   ] }   how retrieve mobile above data in mongo shell?
assuming db.col.findone() finds document you're looking for:
db.col.findone().department.contacts[0].mobile   should it.
Comments
Post a Comment