I am trying to work with the mongo shell, and I am having problems storing the value inside the mongo shell.
when i find the user in the document i store it in doc variable
> var doc = db.users.find({"username":"anil"});
When i print doc in mongo shell i see json object
> doc
{ "_id" : ObjectId("57325aaa48d9231b11e5cb81"), "username" : "anil", "email" : "mongodb@gmail.com" }
However, when I type doc again, I see nothing. its gone. What am I doing wrong here?
> doc
>
It may be something simple, but I do not understand. Can someone point out what I'm doing wrong?
source
share