You can generate ObjectId on the client without consulting database. Such ID will be unique (you’ll have to try damn hard to get two identical object ids).
ObjectId id = new ObjectId();
// or this
ObjectId id = ObjectId.get();
You can generate ObjectId on the client without consulting database. Such ID will be unique (you’ll have to try damn hard to get two identical object ids).
ObjectId id = new ObjectId();
// or this
ObjectId id = ObjectId.get();