I'm using the mongo-jackson-wrapper with java and MongoDB. I find an object by querying a field of mine (not the _id field), and then I need to know the _id field value, whether the net result was an update or an insert. However, I get an exception:
com.mongodb.MongoException: No objects to return
at net.vz.mongodb.jackson.WriteResult.getSavedId(WriteResult.java:97)
The exception comes from the wrapper, not the MongoDB driver itself.
WriteResult<EntityDocument, String> wr
= coll.update(DBQuery.is("corefEntityId", corefEntityId), up, true, false);
What (if anything) is the right way to do this?