开发者

Mongodb automatically write into capped collection

I need to manage the acquisition of many record at hour. About 1000000 records. And I need to get every second the last insert value for every primary key. It works quit well with sharding. I was thinking to try the use os capped collection to get only the last record for every primary 开发者_JS百科key. In order to do this, I made two separated insert, there is a way, into mongodb, to make some kind of trigger to propagate the insert into a collection to another collection?


MongoDB does not have any support for triggers or similar behavior.

The only way to do this is to make it happen in your code. So the code that writes the first entry should also write the second.

People have definitely requested triggers. If they are necessary for your solution, please cast a vote on the feature request.


I disagree with "triggers is needed". People, MongoDB was created to be very fast and to provide as basic functionalities as can be. This is a power of this solution.

I think that here the best think is to create triggers inside Your application as a part of Data Access layer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜