This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Mongo CLI
Sharad Agarwal edited this page Apr 3, 2020
·
7 revisions
List the databases:
show dbs
Create/use a database:
use
database name
See collections inside a database:
show collections
Count values inside the collection:
db.
collectionname
.count()
See data inside the collection:
db.
collectionname
.find()
To see proper JSON formatted data:
db.
collectionname
.findOne()
To remove an entry from the mongodb:
db.
collectionname
.remove({'key
': 'value
'})
eg.
db.actions.remove({'workflow': 'cmsunified_ACDC0_task_B2G-RunIIFall17wmLHEGS-02050__v1_T_191029_073632_8054'})