@Override @Deprecated public <T> Iterable<Key<T>> insert(final T... entities) { return insert(asList(entities)); }
@Override public <T> Key<T> insert(final T entity) { return insert(entity, getWriteConcern(entity)); }
@Override public <T> Iterable<Key<T>> insert(final Iterable<T> entities, final InsertOptions options) { Iterator<T> iterator = entities.iterator(); return !iterator.hasNext() ? Collections.<Key<T>>emptyList() : insert(getCollection(iterator.next()), entities, options); }
@Override public <T> Iterable<Key<T>> insert(final String collection, final Iterable<T> entities) { return insert(collection, entities, new InsertOptions()); }
@Override public <T> Key<T> insert(final T entity, final InsertOptions options) { final T unwrapped = ProxyHelper.unwrap(entity); return insert(getCollection(unwrapped), unwrapped, options); }
/** * Inserts entities in to the database * * @param entities the entities to insert * @param <T> the type of the entities * @return the keys of entities */ @Override public <T> Iterable<Key<T>> insert(final Iterable<T> entities) { return insert(entities, new InsertOptions() .writeConcern(defConcern)); }
@Override public <T> Iterable<Key<T>> insert(final Iterable<T> entities, final WriteConcern wc) { return insert(entities, new InsertOptions().writeConcern(wc)); }
@Override public <T> Key<T> insert(final T entity, final WriteConcern wc) { return insert(entity, new InsertOptions().writeConcern(wc)); }
@Override public <T> Key<T> insert(final String collection, final T entity, final InsertOptions options) { return insert(getCollection(collection), ProxyHelper.unwrap(entity), options); }
@Override public <T> Iterable<Key<T>> insert(final String collection, final Iterable<T> entities, final InsertOptions options) { return insert(getDB().getCollection(collection), entities, options); }
@Override public <T> Iterable<Key<T>> insert(final String collection, final Iterable<T> entities, final WriteConcern wc) { return insert(getDB().getCollection(collection), entities, new InsertOptions() .writeConcern(wc)); }
/** * Inserts an entity in to the database * * @param collection the collection to query against * @param entity the entity to insert * @param wc the WriteConcern to use when deleting * @param <T> the type of the entities * @return the key of entity */ public <T> Key<T> insert(final String collection, final T entity, final WriteConcern wc) { return insert(getCollection(collection), ProxyHelper.unwrap(entity), new InsertOptions().writeConcern(wc)); }
@Override public <T> Key<T> insert(final String collection, final T entity) { final T unwrapped = ProxyHelper.unwrap(entity); return insert(getCollection(collection), unwrapped, new InsertOptions() .writeConcern(getWriteConcern(unwrapped))); }