Monday, July 4, 2016

Mongodb - getting started

1) mongo
-  to launch mongo shell

2) db.adminCommand( { listDatabases: 1 } )
- to list the databases

3) use abc
- assuming 'abc' is one of the databases listed by command 2

4) db.getCollectionNames()
- to list all the collections
- i think we have to run our queries on Collections just like we would run queries on Tables in a Sql database

5) db.users.findOne()
- assuming 'users' is a collection

No comments:

Post a Comment

Followers

Blog Archive