/** * Get the object that was saved. This will contain the updated ID if the ID was generated. * <p/> * Note, this operation is a little expensive because it has to deserialise the object. If you just want the ID, * call getSavedId() instead. * * @return The saved object * @throws MongoException If no objects were saved */ public T getSavedObject() { if (dbObjects.length == 0) { throw new MongoException("No objects to return"); } return getSavedObjects()[0]; }
/** * Get the object that was saved. This will contain the updated ID if the ID was generated. * <p/> * Note, this operation is a little expensive because it has to deserialise the object. If you just want the ID, * call getSavedId() instead. * * @return The saved object * @throws MongoException If no objects were saved */ public T getSavedObject() { if (dbObjects.length == 0) { throw new MongoException("No objects to return"); } return getSavedObjects().get(0); }