Java Code Examples for com.mongodb.client.MongoCollection#withReadConcern()
The following examples show how to use
com.mongodb.client.MongoCollection#withReadConcern() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AggregationOptions.java From morphia with Apache License 2.0 | 5 votes |
@Override public <C> MongoCollection<C> prepare(final MongoCollection<C> collection) { MongoCollection<C> updated = collection; if (writeConcern() != null) { updated = updated.withWriteConcern(writeConcern()); } if (getReadConcern() != null) { updated = updated.withReadConcern(getReadConcern()); } if (getReadPreference() != null) { updated = updated.withReadPreference(getReadPreference()); } return updated; }
Example 2
Source File: AggregationOptions.java From morphia with Apache License 2.0 | 5 votes |
/** * Applies the configured options to the collection. * * @param documents the stage documents * @param collection the collection to configure * @param resultType the result type * @param <T> the collection type * @param <S> the result type * @return the updated collection * @morphia.internal */ public <S, T> AggregateIterable<S> apply(final List<Document> documents, final MongoCollection<T> collection, final Class<S> resultType) { MongoCollection<T> bound = collection; if (readConcern != null) { bound = bound.withReadConcern(readConcern); } if (readPreference != null) { bound = bound.withReadPreference(readPreference); } AggregateIterable<S> aggregate = bound.aggregate(documents, resultType) .allowDiskUse(allowDiskUse) .bypassDocumentValidation(bypassDocumentValidation); if (batchSize != null) { aggregate.batchSize(batchSize); } if (collation != null) { aggregate.collation(collation); } if (maxTimeMS != null) { aggregate.maxTime(getMaxTime(TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS); } if (hint != null) { aggregate.hint(hint); } return aggregate; }
Example 3
Source File: ReadConfigurable.java From morphia with Apache License 2.0 | 5 votes |
default <C> MongoCollection<C> prepare(MongoCollection<C> collection) { MongoCollection<C> updated = collection; if (getReadConcern() != null) { updated = updated.withReadConcern(getReadConcern()); } if (getReadPreference() != null) { updated = updated.withReadPreference(getReadPreference()); } return updated; }