/** * The read preference to use. * * @param readPreference the read preference * @return this */ public Builder readPreference(final ReadPreference readPreference) { this.readPreference = notNull("readPreference", readPreference); return this; }
@Override public TransactionOptions getTransactionOptions() { isTrue("in transaction", transactionState == TransactionState.IN || transactionState == TransactionState.COMMITTED); return transactionOptions; }
@Override public ChangeStreamIterable<TResult> fullDocument(final FullDocument fullDocument) { this.fullDocument = notNull("fullDocument", fullDocument); return this; }
/** * Constructs a new instance. * * @param code the error code * @param message the error message * @param details any details */ public WriteConcernError(final int code, final String message, final DBObject details) { this.code = code; this.message = notNull("message", message); this.details = notNull("details", details); }
GridFSBucketImpl(final String bucketName, final int chunkSizeBytes, final MongoCollection<GridFSFile> filesCollection, final MongoCollection<Document> chunksCollection, final boolean disableMD5) { this.bucketName = notNull("bucketName", bucketName); this.chunkSizeBytes = chunkSizeBytes; this.filesCollection = notNull("filesCollection", filesCollection); this.chunksCollection = notNull("chunksCollection", chunksCollection); this.disableMD5 = disableMD5; }
/** * Sets whether operations using the session should causally consistent with each other. * * @param defaultTransactionOptions the default transaction options to use for all transactions on this session, * @return this * @since 3.8 * @mongodb.server.release 4.0 */ public Builder defaultTransactionOptions(final TransactionOptions defaultTransactionOptions) { this.defaultTransactionOptions = notNull("defaultTransactionOptions", defaultTransactionOptions); return this; }
/** * Sets the cursor type. * * @param cursorType the cursor type * @return this */ public FindOptions cursorType(final CursorType cursorType) { this.cursorType = notNull("cursorType", cursorType); return this; }
/** * Set whether to return the document before it was updated / inserted or after * * @param returnDocument set whether to return the document before it was updated / inserted or after * @return this */ public FindOneAndUpdateOptions returnDocument(final ReturnDocument returnDocument) { this.returnDocument = notNull("returnDocument", returnDocument); return this; }
/** * Sets the name * * @param driverName the name * @return this */ public Builder driverName(final String driverName) { this.driverName = notNull("driverName", driverName); return this; }
/** * Construct a new instance. * * @param filter the non-null query filter */ public DeleteRequest(final BsonDocument filter) { super(); this.filter = notNull("filter", filter); }
/** * Construct an instance * * @param connectionId the connectionId */ public ConnectionCheckedInEvent(final ConnectionId connectionId) { this.connectionId = notNull("connectionId", connectionId); }
/** * Sets the mode for this cluster. * * @param mode the cluster connection mode * @return this; */ public Builder mode(final ClusterConnectionMode mode) { this.mode = notNull("mode", mode); return this; }
/** * Sets the required cluster type for the cluster. * * @param requiredClusterType the required cluster type * @return this */ public Builder requiredClusterType(final ClusterType requiredClusterType) { this.requiredClusterType = notNull("requiredClusterType", requiredClusterType); return this; }
/** * Construct an instance with the given tag set-based value for w. * * @param w tag set name, or "majority", representing the servers to ensure write propagation to before acknowledgment. Do not use * string representation of integer values for w * @mongodb.driver.manual tutorial/configure-replica-set-tag-sets/#replica-set-configuration-tag-sets Tag Sets * @mongodb.driver.manual reference/write-concern/#w-option w option */ public WriteConcern(final String w) { this(w, null, null, null); notNull("w", w); }
/** * Sets the write concern. * * @param writeConcern the write concern * @return {@code this} * @see MongoClientOptions#getWriteConcern() */ public Builder writeConcern(final WriteConcern writeConcern) { this.writeConcern = notNull("writeConcern", writeConcern); return this; }
/** * Creates an instance. * @param cluster a non-null Cluster which will be used to select a server to bind to * @param readPreference a non-null ReadPreference for read operations * @param readConcern a non-null read concern * @since 3.8 */ public ClusterBinding(final Cluster cluster, final ReadPreference readPreference, final ReadConcern readConcern) { this.cluster = notNull("cluster", cluster); this.readPreference = notNull("readPreference", readPreference); this.readConcern = notNull("readConcern", readConcern); }
/** * Sets the write concern. * * @param writeConcern the write concern * @return this * @see MongoClientSettings#getWriteConcern() */ public Builder writeConcern(final WriteConcern writeConcern) { this.writeConcern = notNull("writeConcern", writeConcern); return this; }
/** * Construct a new instance. * * @param filter a document describing the query filter, which may not be null. * @param options the options to apply * @since 3.4 * @mongodb.server.release 3.4 */ public DeleteManyModel(final Bson filter, final DeleteOptions options) { this.filter = notNull("filter", filter); this.options = notNull("options", options); }
/** * Construct an instance * * @param connectionId the connectionId */ public ConnectionRemovedEvent(final ConnectionId connectionId) { this.connectionId = notNull("connectionId", connectionId); }