capped-collections

Set limits on mongo db collection

十年热恋 提交于 2020-03-05 12:21:10
问题 So, there are two limits I want to set in mondo db: 1. Only allow one document to be inserted into the dbs, and no more. This document cannot be deleted once added, BUT it can be modified. Also, no other documents can be added to that collection. Only one value will be allowed under this schema. { "_id" : ObjectId("5800"), "seconds" : "120", "__v" : 0 } No more new seconds will be allowed to be added in, and only the above document can be modified. I have tried: var numbersSchema = new

Set limits on mongo db collection

十年热恋 提交于 2020-03-05 12:20:18
问题 So, there are two limits I want to set in mondo db: 1. Only allow one document to be inserted into the dbs, and no more. This document cannot be deleted once added, BUT it can be modified. Also, no other documents can be added to that collection. Only one value will be allowed under this schema. { "_id" : ObjectId("5800"), "seconds" : "120", "__v" : 0 } No more new seconds will be allowed to be added in, and only the above document can be modified. I have tried: var numbersSchema = new

Play + ReactiveMongo: capped collection and tailable cursor

*爱你&永不变心* 提交于 2019-12-25 06:13:04
问题 I'm using Play Framework with Scala, Akka and ReactiveMongo. I want to use a collection in MongoDB as a circular queue. Several actors can insert documents into it; one actor retrieves these documents as soon as they're available (a sort of publish-subscribe system). I'm using capped collections and tailable cursor. Everytime I retrieve some documents I have to run the command EmptyCapped to flush the capped collection (it's not possible to REMOVE elements from it) otherwise I retrieve always

Play + ReactiveMongo: capped collection and tailable cursor

本秂侑毒 提交于 2019-12-25 06:11:16
问题 I'm using Play Framework with Scala, Akka and ReactiveMongo. I want to use a collection in MongoDB as a circular queue. Several actors can insert documents into it; one actor retrieves these documents as soon as they're available (a sort of publish-subscribe system). I'm using capped collections and tailable cursor. Everytime I retrieve some documents I have to run the command EmptyCapped to flush the capped collection (it's not possible to REMOVE elements from it) otherwise I retrieve always

track deleted documents in Mongo DB's capped collection

拟墨画扇 提交于 2019-12-12 18:05:15
问题 Is there any options which allow to track document when it goes to be deleted from capped collection? For example, I have a list of orders with the status - handled or not. So I want to persist that orders in in capped collection and check status each time, when mongo decide to delete some doc. If order was handled - so, cool, just let him leave, but if it wasn't handled, just push it back to the queue. 回答1: Capped collections are fixed-sized collections which automatically remove the oldest