-
Type:
Task
-
Resolution: Incomplete
-
Priority:
Minor - P4
-
None
-
Affects Version/s: 2.4
-
Component/s: Command Operations
-
None
-
Environment:development
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Hi there,
We're setting up a document collection that will hold 24 months of data result sets that we'll use to supply data to our reporting applications.
We're currently using an array to hold the result sets, each element in the array contains the rows of data that pertain to a particular month.
We're going to build up the documents month-by-month, and are using a TTL index (so we have PowerOf2Sizes for the collection). I thought I had understood that we can help with space allocation by allocating 24 elements to the array when we first create the document.
My question is, what's the most efficient way to do that? I thought I could use the $setOnInsert property to establish the array, then use a $set in the same update statement to insert the element into the array, but I found that's not allowed.
Now it feels like I need to make a separate call to check whether the document exists, add the 24 element array, then have a second statement that adds the first element. Checking whether a document exists before each update statement sounds like a lot of overhead to me, so I wanted to ask the question about how best to accomplish this.
Thanks for your help!
Matt