[JAVA-37] Ability to create capped collections in the java driver Created: 21/Sep/09 Updated: 23/Mar/10 Resolved: 23/Sep/09 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 0.11 |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Ryan Nitz | Assignee: | Kristina Chodorow (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Currently you can only get a collection by calling: public DBCollection getCollection(String n) Will need: public DBCollection getCollection(String n, DBObject o) (in order to create a capped collection) db.createCollection("mycoll", {capped:true, size:100000}) |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 23/Mar/10 ] |
|
You can check to see if the collection exists already by calling getCollectionNames |
| Comment by kiran k [ 23/Mar/10 ] |
|
how could I avoid getting collection already exists message. I was trying to use createcollection and wanted the following functionality. If collection exists consider that, otherwise create one. But when my createcollection executes for the second time after creating one its throwing an error saying collection already exists. |
| Comment by Kristina Chodorow (Inactive) [ 23/Sep/09 ] |
|
Changed to createCollection(String name, DBObject o). |
| Comment by Kristina Chodorow (Inactive) [ 22/Sep/09 ] |
|
Making it createCollection, not getCollection |
| Comment by Kristina Chodorow (Inactive) [ 22/Sep/09 ] |
|
Added DBBase.getCollection(String name, DBObject opts). All fields in the second param are optional. An example: capped = db.getCollection(name, BasicDBObjectBuilder.start().add("capped", true).add("size", size).add("max", maxNumElements).get()); |