1. How to list all the collection names ?.
A: db.getCollectionNames();
2. How to clear the cmd prompt ?.
A: cls
3. How to get list of database names?.
A: db.adminCommand({ listDatabases : 1});
4. How to know the currently using database ?.
A: db
5. How to print Collection in JSON format in Mongoshell ?.
A: db.collectionName.find().limit(<no of collections>).pretty();
6. How to replace or rename a key in collection.
A: db.collectionName.update({},{$replace:{'old value':'new value'}});
A: db.getCollectionNames();
2. How to clear the cmd prompt ?.
A: cls
3. How to get list of database names?.
A: db.adminCommand({ listDatabases : 1});
4. How to know the currently using database ?.
A: db
5. How to print Collection in JSON format in Mongoshell ?.
A: db.collectionName.find().limit(<no of collections>).pretty();
6. How to replace or rename a key in collection.
A: db.collectionName.update({},{$replace:{'old value':'new value'}});