goncalossilva / mongoid-sequence

Specify fields to behave like a sequence number (exactly like the "id" column in conventional SQL flavors) while using Mongoid.
MIT License
18 stars 36 forks source link

mongoid-sequence with a MongoDB replica set... #5

Open abhas opened 11 years ago

abhas commented 11 years ago

Is the consistency of mongoid-sequence guaranteed when operating with MongoDB configured as a replica set? I am trying to building a HA configuration with my rails app and MongoDB use mongoid-sequence to generate serial numbers for my records. Am I guaranteed that these sequence numbers will be unique across the replica set?

Thanks.... -abhas.

flexoid commented 11 years ago

With replica set configuration you perform all your writes to only one instance, primary. So this values will be unique even with replication lag on secondaries.