/** * Configures this modifier so that new (updated) version of document will be returned in * case of successful update. * @see #returningOld() * @return {@code this} modifier for chained invocation */ // safe unchecked: we expect I to be a self type @SuppressWarnings("unchecked") public final M returningNew() { options.returnDocument(ReturnDocument.AFTER); return (M) this; }
/** * Configures name for an index, that is otherwise will be auto-named by index fields. * @param indexName explicitly provided index name * @return {@code this} indexer for chained invocation */ // safe unchecked: we expect I to be a self type @SuppressWarnings("unchecked") public final I named(String indexName) { options.name(indexName); return (I) this; }
/** * Makes an index to enforce unique constraint. * @return {@code this} indexer for chained invocation */ // safe unchecked: we expect I to be a self type @SuppressWarnings("unchecked") public final I unique() { options.unique(true); return (I) this; }
/** * Configures this modifier so that new (updated) version of document will be returned in * case of successful update. * @see #returningOld() * @return {@code this} modifier for chained invocation */ // safe unchecked: we expect I to be a self type @SuppressWarnings("unchecked") public final M returningNew() { options.returnDocument(ReturnDocument.AFTER); return (M) this; }
/** * Creates an update that adds each of the given values to the array value of the field with the given name. * * @param fieldName the non-null field name * @param values the values * @param <TItem> the value type * @return the update * @mongodb.driver.manual reference/operator/update/push/ $push */ public static <TItem> Bson pushEach(final String fieldName, final List<TItem> values) { return new PushUpdate<TItem>(fieldName, values, new PushOptions()); }
/** * Gets the sort criteria to apply to the query. The default is null, which means that the documents will be returned in an undefined * order. * * @return a document describing the sort criteria * @mongodb.driver.manual reference/method/cursor.sort/ Sort */ DBObject getSortDBObject() { return options.getSort(); }
/** * Returns the readConcern * * @return the readConcern * @mongodb.server.release 3.2 */ public ReadConcern getReadConcern() { return options.getReadConcern(); }
/** * Returns the upsert * * @return the upsert */ public boolean isUpsert() { return options.isUpsert(); }
/** * Returns the returnNew * * @return the returnNew */ public boolean isReturnNew() { return options.returnNew(); }
/** * Sets the writeConcern * * @param writeConcern the writeConcern * @return this * @mongodb.server.release 3.2 */ public FindAndModifyOptions writeConcern(final WriteConcern writeConcern) { options.writeConcern(writeConcern); return this; }
/** * Gets the hint to apply. * * @return the hint, which should describe an existing */ public String getHint() { return options.getHintString(); }
/** * Sets the number of documents to return per batch. * * @param batchSize the batch size * @return this * @mongodb.driver.manual reference/method/cursor.batchSize/#cursor.batchSize Batch Size */ public FindOptions batchSize(final int batchSize) { options.batchSize(batchSize); return this; }
/** * Sets the collation * * @param collation the collation * @return this * @mongodb.server.release 3.4 */ public CountOptions collation(final Collation collation) { options.collation(collation); return this; }
/** * Returns true if a new document should be inserted if there are no matches to the query filter. The default is false. * * @return true if a new document should be inserted if there are no matches to the query filter */ public boolean isUpsert() { return options.isUpsert(); }
/** * Sets the bypass document level validation flag. * * @param bypassDocumentValidation If true, allows the write to opt-out of document level validation. * @return this * @mongodb.server.release 3.2 */ public UpdateOptions bypassDocumentValidation(final Boolean bypassDocumentValidation) { options.bypassDocumentValidation(bypassDocumentValidation); return this; }
/** * Sets whether all documents matching the query filter will be removed. * * @param multi true if all documents matching the query filter will be removed * @return this */ public UpdateOptions multi(final boolean multi) { options.multi(multi); return this; }
/** * Sets the collation * * @param collation the collation * @return this * @mongodb.server.release 3.4 */ public FindAndModifyOptions collation(final Collation collation) { options.collation(collation); return this; } }
/** * Sets the collation * * @param collation the collation * @return this * @mongodb.server.release 3.4 */ public DeleteOptions collation(final Collation collation) { options.collation(collation); return this; }
/** * Configures this modifier so that old (not updated) version of document will be returned in * case of successful update. * This is default behavior so it may be called only for explanatory reasons. * @see #returningNew() * @return {@code this} modifier for chained invocation */ // safe unchecked: we expect I to be a self type @SuppressWarnings("unchecked") public final M returningOld() { options.returnDocument(ReturnDocument.BEFORE); return (M) this; }
/** * Configures this modifier so that old (not updated) version of document will be returned in * case of successful update. * This is default behavior so it may be called only for explanatory reasons. * @see #returningNew() * @return {@code this} modifier for chained invocation */ // safe unchecked: we expect I to be a self type @SuppressWarnings("unchecked") public final M returningOld() { options.returnDocument(ReturnDocument.BEFORE); return (M) this; }