This question pertains to 4th version of RavenDb only. With previous versions we had an option to generate Identity Key for a collection viz.
_documentStore.DatabaseCommands.NextIdentityFor(collectionName);
How do I do the same in RavenDb 4?
In RavenDB 4.0, this is now done as:
using (var shortTermSingleUse = JsonOperationContext.ShortTermSingleUse())
{
var command = new NextIdentityForCommand("users");
await store.GetRequestExecutor().ExecuteAsync(command, shortTermSingleUse);
}