How to get the compression type of a MongoDB collection ?!
To specify compression for specific collections, you’ll need to override the defaults by passing the appropriate options in the db.createCollection() command. For example, to create a collection called “myNewCol” using the zlib compression library: db.createCollection( “myNewCol”, { storageEngine: { wiredTiger:…
MongoDB 3.x WiredTiger with gridFs ? Is it recommendable ?!
If you’re using GridFS to store large documents such as images and videos, MongoDB automatically breaks the large files into many smaller “chunks” and reassembles them when requested. The implementation of GridFS maintains two collections: fs.files, which contains the metadata for…
How to know existing shard tags and their ranges ?!
mongos> sh.status() — Sharding Status — sharding version: { “_id” : 1, “minCompatibleVersion” : 5, “currentVersion” : 6, “clusterId” : ObjectId(“568bbc90f165cf6ce558ef40”) } shards: { “_id” : “rs1”, “host” : “rs1/srinivas-HP-G62-Notebook-PC:27010,srinivas-HP-G62-Notebook-PC:27011”, “tags” : [ ] } { “_id” : “rs2”, “host”…
Shard Tagging with overlapping/Same ranges ?!!
What will happen when you create a Shard Tagging with overlapping ranges ?!! See below. Any given shard key range may only have one assigned tag. You cannot overlap defined ranges, or tag the same range more than once –…
How to know current storage engine in MongoDB ?
Ideally, db.serverStatus() gives the all the server related information including storage engine details, however below command will specifically tell you the storage engine details. Connect to the respective Replica set member and execute below command. rs1:PRIMARY> db.serverStatus().storageEngine.name wiredTiger OR…
Distributed consensus in MongoDB’s replication system
Distributed Consensus in MongoDB’s Replication System Hi MongoDB User, Take an hour to see how changes to MongoDB’s election protocal will lead to faster elections, more robust systems, and lay the groundwork for new replication features going forward….
MongoDB 3.2 Shard creation script
Below shell script will be useful to create a MongoDB’s sharded environment on a single sever/multiple servers depending on your requirement. Things to remember to execute below automated script. 1) We should have required privileges to the user on your…
MongoDB query to get the stats of all collections in all databases
To collect the stats of all the collections in all databases from a mongo shell, you can run below query. db.getMongo().getDBNames().forEach(function (d) { print(“Database: ” + d ); var curr_db = db.getSiblingDB(d); printjson( curr_db.stats() ); curr_db.getCollectionNames().forEach(function(coll) { print(“.. collection: ”…
MongoDB 3.2 Installation
1) Know your OS version & OS bit type with following commands to download the MongoDB packages. [ root@dbversity.com #]more /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION=”Ubuntu 14.04.3 LTS” [ root@dbversity.com #] [ root@dbversity.com #]uname -a Linux srinivas-HP-G62-Notebook-PC 3.19.0-42-generic#48~14.04.1-Ubuntu SMP Fri Dec…
Why The Hell Would I Use Node.js? A Case-by-Case Tutorial
Introduction JavaScript’s rising popularity has brought with it a lot of changes, and the face of web development today is dramatically different. The things that we can do on the web nowadays with JavaScript running on the server, as well…