/** * Get the objects that were saved. These will contain the updated IDs if the IDs were generated. * <p/> * This operation only works if object serialization is used. If stream serialization is used, the IDs are * generated by the database, and cannot be known. * <p/> * Note, this operation is a little expensive because it has to deserialise the objects. If you just want the IDs, * call getSavedIds() instead. * * @return The saved objects */ public T[] getSavedObjects() { // Lazily generate the object, in case it's not needed. if (objects == null) { if (dbObjects.length > 0) { if (dbObjects[0] instanceof JacksonDBObject) { throw new UnsupportedOperationException("Saved object retrieval not supported when using stream serialization"); } } objects = jacksonDBCollection.convertFromDbObjects(dbObjects); } return objects; }
/** * Get the objects that were saved. These will contain the updated IDs if the IDs were generated. * <p/> * This operation only works if object serialization is used. If stream serialization is used, the IDs are * generated by the database, and cannot be known. * <p/> * Note, this operation is a little expensive because it has to deserialise the objects. If you just want the IDs, * call getSavedIds() instead. * * @return The saved objects */ public List<T> getSavedObjects() { // Lazily generate the object, in case it's not needed. if (objects == null) { if (dbObjects.length > 0) { if (dbObjects[0] instanceof JacksonDBObject) { throw new UnsupportedOperationException("Saved object retrieval not supported when using stream serialization"); } } objects = jacksonDBCollection.convertFromDbObjects(dbObjects); } return objects; }