In the application, I use the concept of bucketsstoring objects. All buckets are empty at the time of creation. Some of them can fill up to a maximum capacity of 20 objects in 2 hours, and after 6 months. Each size of the object is largely fixed, that is, I do not expect their size to differ by more than 10%, i.e. Full bucket sizes will also not be. The implementation is similar to the implementation.
@Document
public class MyBucket {
private List<MyObject> objects;
}
One approach to keeping the minimum padding factoris to prefill my bucket with dummy data. Two options come to me:
- Create a bucket with dummy data, save it, then reset its contents and save it again
- Create a bucket of dummy data and mark it as “untouched”. The first time the flag is set to false, the data is reset.
The disadvantages are obvious, for option 1 two database entries are required, for option 2 additional (not a business code) is required in my entities.
I guess I can’t get out cheaply with any solution. However, any real experience with this question, any best practices or tips?
Setup: Spring Data MongoDB 1.9.2, MongoDB 3.2
source
share