Mongodb Classroom image

Anil  Bist / Professional / DataBase

 
To post your Question Join Classroom
 
Lesson Topics's No:-  ||
Lessons:-Read

Read

Query for all the docs in the people collection that have a name field with a value of 'Tom':

db. people.find ( { name: 'Tom' } )

 

Or just the first one:

db. people.findOne ({name: ' Tom '})  

 

You can also specify which fields to return by passing a field selection parameter. The following will exclude the _id field and only include the age field:

db. people.find ( { name: 'Tom' }, { _id: 0, age: 1 })  

 

Note: by default, the _id field will be returned, even if you don't ask for it. If you would like not to get the _id back, you can just follow the previous example and ask for the _id to be excluded by specifying _id: 0 (or _id: false).If you want to find sub record like address object contains country, city, etc.

db. people.find ( { 'address.country': 'US' } )  

 

& specify field too if required

 

 
 
 
image
Anil  Bist

Skills    Mongodb

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-

in 2006, i Join a web development company in Bangalore and start work on "Ruby on Rail" this is my first web development framework and we worked in this framework and develop four to five project after some time , I moved to JEE/Sturst frame work,

After some time i decided that now times come and I have to go on in my own way and I started a company name is "Soarlogic&q
Explore

 

  Students (0)