[SERVER-2932] Create capped collections automatically at the first insertion Created: 12/Apr/11  Updated: 15/Feb/13  Resolved: 18/Sep/12

Status: Closed
Project: Core Server
Component/s: Performance
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: Giorgio Merlini Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Win32 C++ (VS2008)


Participants:

 Description   

Is it possible creating capped collections automatically at the first
insertion?

I receive some "packets" from a client. This data contains a name as
the first field. I don't know all these names "a priori", but I'd like
storing those data in capped collection (size is known). As far as I
know, if I db.insert("name") I'll create a no-capped collection... can
I change such behaviour? I'd like to avoid checks for existing tables
before storing (I can receive thousand of packets with the same name
and this check is unreasonable...).



 Comments   
Comment by Eliot Horowitz (Inactive) [ 18/Sep/12 ]

No way to do that, but you can convert later, and if its is small (i.e. check 1/1000 times) then converting will be very fast.

Comment by Giorgio Merlini [ 12/Apr/11 ]

I agree. Unfortunately I haven't this information at startup and create capped collection before insertion means checking whether collection exists for each incoming data.
Of course I can solve this programmatically; just wondering whether such feature can be interesting...
About additional information (in case this feature is implemented): a Connection.SetDefaultTableCreationOption() or similar can be implemented.

In any case: thanks for your attention in this request

Comment by Scott Hernandez (Inactive) [ 12/Apr/11 ]

If you know the name of the collection then you should create the capped collection before you insert data. By default collections are created non-capped since creating them as capped collections would require more information than is available during an insert/save.

Generated at Thu Feb 08 03:01:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.