Skip to content

Commit

Permalink
Merge pull request #256 from tyronegroves/counters_upsert
Browse files Browse the repository at this point in the history
Changed Counters FindAndModify to upsert so that the collection is created on the first checkpoint
  • Loading branch information
damianh committed Sep 22, 2013
2 parents b36253e + 06a1639 commit fde08c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/NEventStore.Persistence.MongoDB/MongoPersistenceEngine.cs
Expand Up @@ -49,9 +49,9 @@ public MongoPersistenceEngine(MongoDatabase store, IDocumentSerializer serialize

_getNextCheckpointNumber = () => TryMongo(() =>
{
IMongoQuery query = Query.And(Query.EQ("_id", "CheckpointNumber"));
IMongoQuery query = Query.EQ("_id", "CheckpointNumber");
IMongoUpdate update = Update.Inc("seq", 1);
FindAndModifyResult result = Counters.FindAndModify(query, null, update, true);
FindAndModifyResult result = Counters.FindAndModify(query, null, update, true, true);
return result.ModifiedDocument["seq"].ToInt32();
});
}
Expand Down

0 comments on commit fde08c6

Please sign in to comment.