Is there an easy way to get the ID (ObjectID) of the last inserted document of a mongoDB instance using the Java driver?
I just realized you can do this:
BasicDBObject doc = new BasicDBObject( "name", "Matt" ); collection.insert( doc ); ObjectId id = (ObjectId)doc.get( "_id" );
1.4m articles
1.4m replys
5 comments
57.0k users