Created
March 28, 2014 18:59
-
-
Save jamestyj/9840403 to your computer and use it in GitHub Desktop.
Enable usePowerOf2Sizes on a collection with Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.mongodb.BasicDBObject; | |
import com.mongodb.DB; | |
import com.mongodb.MongoClient; | |
import java.net.UnknownHostException; | |
public class powerOf2Sizes { | |
public static void main(String[] args) throws UnknownHostException { | |
MongoClient mongoClient = new MongoClient(); | |
DB db = mongoClient.getDB("myDB"); | |
db.createCollection("myCollection", new BasicDBObject()); | |
BasicDBObject cmd = new BasicDBObject("collMod", "myCollection").append("usePowerOf2Sizes", true); | |
db.command(cmd); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment