Monday, 12 August 2013

Is this a valid mongo command format? db.[database].[collection].find()

Is this a valid mongo command format? db.[database].[collection].find()

I use MongoHub for most of my queries. I noticed that it generates a mongo
command when I fill out the search criteria.
For example, it will generate something like this:
db.myDatabase.myCollection.find().sort({ "_id": 1}).skip(0).limit(30)
When I type db.myDatabase.myCollection.find() into the mongo shell
command, nothing is returned. (No error message is generated either).
If instead I type:
{
use myDatabase
db.myCollection.find()
}
then I get results back.
Anyone know how mongo interprets db.[???].[????].find()?

No comments:

Post a Comment