top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to change the compression of one existing collection in MongoDB?

+1 vote
620 views

I have a DB with several (quite big) collections, on Mongo 3.2.5 and WiredTiger with snappy compression on. I would like to change the compression setting on one small collection I have to test it uncompressed. Is there a possibility to do that on a secondary without having to resync the whole DB?

posted Apr 25, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Hi try this script to compress particular collection:
repair collection using command "mongod --repair"
or by running command "db.repairDatabase()"
using db.runCommand({ compact: <collection name> })
OR follow this blogpost for many collection compression methods available.
BlogLink: https://www.mongodb.com/blog/post/new-compression-options-mongodb-30

answer Apr 29, 2016 by Shivam Kumar Pandey
Similar Questions
+2 votes

suppose, I have an existing capped collection with the following syntax.

db.createCollection("mycappedCollection",{capped: true, size: 2, max:2})

Now, what i want is to modify the above collection and add the autoIndexId option.
like:

db.createCollection("mycappedCollection",{capped: true, autoIndexId: true, size: 2, max:2})

How can I modify the existing mycappedCollection?

0 votes

MONGODB 3.2.8, WIREDTIGER STORAGE ENGINE
SINGLE COLLECTION HAS MORE THAN 500G, WHETHER IT NEEDS TO BE SEPARATED?

WHAT PARAMETER SHOULD BE ADJUSTED ?

...