Skip to content

MongoDB Sequential integer Id Generator - Uses findAndModify to create sequential id's

Notifications You must be signed in to change notification settings

alexjamesbrown/MongDBIntIdGenerator

Repository files navigation

MongoDBIntIdGenerator

MongoDB Sequential integer Id Generator - Uses findAndModify to create sequential id's

Designed to provide sequential int IDs for documents, using the method outlined here: http://www.alexjamesbrown.com/blog/development/mongodb-incremental-ids/

Some unit tests are included, however this is not yet tested on scale, with replica sets etc...

Usage

BsonClassMap.RegisterClassMap<MyClass>(cm => {
    cm.AutoMap();
    cm.IdMemberMap.SetIdGenerator(new Int32IdGenerator());
});

BsonClassMap.RegisterClassMap<MyClass>(cm => {
    cm.AutoMap();
    cm.IdMemberMap.SetIdGenerator(new Int64IdGenerator());
});

About

MongoDB Sequential integer Id Generator - Uses findAndModify to create sequential id's

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages