3 ms·
A MongoDB Garbage Collection
- bobfunk 15y agoI'm wondering if anybody else has been using this technique with document oriented databases?
- mikelbring 15y agoI asked the same thing on the blog but I thought I'd ask here as well. Is there a better way to move a document to another collection with out inserting into the new collection and then deleting? I am guessing it wouldn't be a straight move, youd actually have something like this in your document {collection_from: users, timestamp: now(), data: $moved_collection_data}
- bobfunk 15y agoIn our case the documents we move to the garbage collection already have a _type property that stores the class name and we do add a "deleted_at" property to the new document in the garbage collection. But in the end, there's no other way to do the move than creating a copy and then deleting the original. This is also neither atomic nor transactional, but since we create the copy in the garbage collection before deleting we won't loose data no matter what...