- Dowload mongosh
https://www.mongodb.com/docs/mongodb-shell/
- Open terminal check version
mongosh --version
- Start mongosh
mongosh;
- Show all databases
show databases
show dbs
- Use database
use databaseName
- Show collections, tables
show tables
db.getCollectionNames()
show collections
- Show fields
Object.keys(db.posts.findOne());
- Select fields
db.posts.find({}, { _id: 0, title: 1, body: 1 });