MongoDB Basics
Installing MongoDB
Community edition Setup
Installation steps can be found at https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/
Inshort download windows installer from https://www.mongodb.com/download-center/community
MongoDB free tutorials at Link
MongoDB docs Link
Others :
- Use MongoDB compass as UI tool (+ https://robomongo.org/download Robo 3T)
- Use shell for command interface (mongo.exe -> say C:\Program Files\MongoDB\Server\4.0\bin\mongo.exe)
- INDEXES (MD)
- Aggregation (MD)
- Validation (MD)
- Security (MD)
- Shell Commands (MD)
- Capped Collections (MD)
- DB backup (MD)
Replicas
- Docs
- Config
- FAQ
- Backup/ fault tolerancy //must
- improved read performance (like load balancer) //little sync latency issue
Sharding
- Docs
- To use more computing power, spreading data across nodes Note : queries run across all shards / use shardKey to target specific
- Foreign Keys
- MongoDB locks scenario
- MongoDB Limits
- MongoDB BsonTypes
- MongoDB ConfigFile
- MongoDB Compass
- MongoDB charts (enterprise)
- MongoDB Stitch (serverless platform) //cloud
- MongoDB Realm //cloud & moobile sync
- https://docs.mongodb.com/manual/core/gridfs/
Other links
- https://www.mongodb.com/products/consulting
- For more information, please visit mongodb.com or contact us at sales@mongodb.com.
- Case Studies
- Presentations
- Free Online Training
- Webinars and Events
- Documentation
- MongoDB Atlas database as a service for MongoDB
- MongoDB Enterprise Download
- MongoDB Stitch Serverless Platform
- MongoDB Realm
- Press
Commands
Windows to stop service through command (or do it from services.msc UI)
net stop MongoDBMongoD Docs
Start manually MongoDB server with default DB path (/data/db at root level)
mongodNote : default database folder path must exist. In windows - with in installed folder say 'E:\mongodb_storage\Server\4.0\data\db'
Check all arguments options like --logpath, --dbpath, --config ..etc
mongod --helpNote : Use --directoryperdb setting else all collection files are stored in root folder. (Each database will be stored in a separate directory)
To Start MongoDB server with custom DB path
sudo mongod --dbpath "/custom/linux/Path" --port 27018mongod --dbpath "drive:\custom\win\Path" --port 27018Note: sudo : it asks for password if permission doesn't exist //so command doesnot fail
Mongo Shell Docs if port is changed then open shell with port //mongo --port 27018 Can open shell with help //mongo --help //--host, --username, --password, --nodb (to just execute some JS)
- Common with in shell commands : .pretty() at the end of query for formatted JSON o/phelpshow dbs //even shows sizeshow collectionsdb //check current dbuse db_name //will be created if not existsdb.stats()
Open connections
To check no of open connections (Note: clusterMonitor role must be added to the user)
To find sources of connections (say source ip adress)
Note : check (ESTABLISHED) message in the lines
- Restart mongodb instance to kill most connections
White paper
- RDBMStoMongoDBMigration.pdf added in current folder