MongoDB Profiler

Profiler collects fine grained data about MongoDB write operations, cursors, database commands on a running mongod instance. You can enable profiling on a per-database or per-instance basis. The profiler is off by default. Profiler writes all the data it collects to the system.profile collection, which is a capped collection. *.Profiling Levels 0 – the profiler […]

Read More

MongoDB Statistics

If you want to objects statistics like (No. of object, collections, datasize etc. Available) follow below the commands. use database db.stats();                             <—————- Get the database level statistics db.technology.stats();          <—————- Get the  collection level statistics db.runCommand( { collStats […]

Read More

MongoDB Clone Collection

Mongos does not support db.cloneCollection(). 1st Method db.cloneCollection(from, collection, query); db.cloneCollection(‘mongodb.example.net:27017’, ‘profiles’,{ ‘active’ : true } ) 2nd Method depricated since 3.0 version db.collection.copyTo(“new collection name”); # But its depricated in 3.4 but it works. 3st Method With Mongodump mongodump –db db-name –collection collection-name –archive=collection-name.archive For more detail about Clone Collection: Click Here

Read More

MongoDB Host and Port

Get the detail of mongodb Host and mongodb runing on which port fo you get all these type of info from mongo shell. getHostName(); # Hostname info db.serverCmdLineOpts(); # Port info db.serverCmdLineOpts().parsed.net.port db.runCommand({whatsmyuri : 1}) # Its is showing both Hostname and Port

Read More

MongoDB Rename Collection

Yes you can rename the collection if required but it is not supported on sharded collections. db.collection.renameCollection()  db.collection.renameCollection(); db.test_my.renamecollection(“test”); use admin db.adminCommand( { renameCollection: “mydb.test_my”, to: “mydb.test” } )

Read More

MongoDB User Creation Details

Good Morning All, Now today give you a small demo for creating user, gives permission and getting user info. # Create user Syntax: db.createuser( {user : “mylogin” , pwd : “mylogin”, roles : [] }); db.createuser( {user : “mylogin” , pwd : “mylogin”, roles : [{role : “userAdminAnyDatabase”, db : “admin”}]});     <—– Full […]

Read More

MongoDB GridFS

GridFS is a versatile storage system that is suited to handling large files, such as those exceeding the 16 MB document size limit.   For more details about GridFs : Click Here

Read More

MongoDB Checkpoint

Yes checkpoint also available in MongoDB: Read my Previous Post Journaling clear the all deatils how the data will be written on physical files. Every 60 seconds or journal file reach 2 GB . whichever first  

Read More

MongoDB Journaling

It’s also part of storage : the journal is a log that helps the database recover in the event of a hard shutdown. There are several configurable options that allows the journal to strike a balance between performance and reliability that works for your particular use case. In simple Words: With journaling, MongoDB’s storage layer […]

Read More

MongoDB Storage/Storage Engine

The storage engine is the primary component of MongoDB responsible for managing data. MongoDB provides a variety of storage engines, allowing you to choose one most suited to your application. WiredTiger Storage Engine (Default) MMAPv1 Storage Engine (Deprecated as of MongoDB 4.0) In-Memory Storage Engine (Rarely Used) Pluggable Storage Engine. (Customized accordingly requirement) Click Here […]

Read More