Mongodb – How to setup sync between MongoDB and C# .NET Application

cdata synchronizationdatabase-designmongodbreplication

What is the best practice to synchronize a MongoDB remote database with a C# .NET App that would allow queries to be responded to within the local file system and update itself when there is a change in the master database which is on a remote web server.

Some methods I came across are syncing MongoDB to a local JSON file using Node.js.

Please suggest a solution.

Best Answer

You need a tailable cursor (http://docs.mongodb.org/master/tutorial/create-tailable-cursor/) that will read the MongoDB oplog and propagate the changes. The oplog logs every CRUD operation and the tailable cursor will trigger on every change.