How to see any changes (new row) in mongoDB?

前端 未结 1 1761
灰色年华
灰色年华 2021-01-14 19:40

Is there any way to observe each collection (or even one) in mongoDB? Now I think about timer to check document number or last Id, but maybe there

相关标签:
1条回答
  • 2021-01-14 20:21

    There are no triggers in MongoDB (yet?), but if you're running a replica set (as you should), your app can pretend to be a catching-up secondary, tail the oplog collection and get information about new inserts/updates.

    This is a very efficient approach (mongodb itself uses it for the replication).

    0 讨论(0)
提交回复
热议问题