1.

                   db.sample.updateMany( { y : { $gte : 10 } },{ $set : { y : 75 } } )

Answer»

Every operation on the primary is logged in operation logs known as oplog. These oplogs are replicated to For a healthy replica set system, it is RECOMMENDED that all members are in sync with no replication lag. Data is first written on primary by the applications then replicated to secondary. This synchronization is important to MAINTAIN up-to-date copies of data on all members. Synchronization happens in 2 ways: initial sync and continuous replication.

  • Initial Sync: When we add new member to replica set data from one member is copied to the new member. When we perform an initial sync, MongoDB copies all databases one by one except the local database. This is done by scanning all collections in the source database and inserting them on a new member. All indexes are also copied during the initial syn. There MIGHT be changes to the data set when initial sync happens. At the end of copy, the changes from already copied collections are applied USING oplog.
  • Continuous Replication: After the initial sync the secondary members replicate data continuously. We can decide which member sync happens. The replication of secondary member from their sync source happens asynchronously. These replications happen using oplog.


Discussion

No Comment Found