private FindOperation<BsonDocument> createExplainableQueryOperation() { FindOperation<BsonDocument> explainFindOperation = new FindOperation<BsonDocument>(namespace, new BsonDocumentCodec()); BsonDocument explainModifiers = new BsonDocument(); if (modifiers != null) { explainModifiers.putAll(modifiers); } explainModifiers.append("$explain", BsonBoolean.TRUE); return explainFindOperation.filter(filter) .projection(projection) .sort(sort) .skip(skip) .limit(Math.abs(limit) * -1) .hint(hint) .min(min) .max(max) .modifiers(explainModifiers); }
@SuppressWarnings("deprecation") private <TResult> FindOperation<TResult> createFindOperation(final MongoNamespace findNamespace, final Bson filter, final Class<TResult> resultClass, final FindOptions options) { return new FindOperation<TResult>(findNamespace, codecRegistry.get(resultClass)) .filter(filter == null ? new BsonDocument() : filter.toBsonDocument(documentClass, codecRegistry)) .batchSize(options.getBatchSize()) .skip(options.getSkip()) .limit(options.getLimit()) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .maxAwaitTime(options.getMaxAwaitTime(MILLISECONDS), MILLISECONDS) .modifiers(toBsonDocumentOrNull(options.getModifiers())) .projection(toBsonDocumentOrNull(options.getProjection())) .sort(toBsonDocumentOrNull(options.getSort())) .cursorType(options.getCursorType()) .noCursorTimeout(options.isNoCursorTimeout()) .oplogReplay(options.isOplogReplay()) .partial(options.isPartial()) .slaveOk(readPreference.isSlaveOk()) .collation(options.getCollation()) .comment(options.getComment()) .hint(toBsonDocumentOrNull(options.getHint())) .min(toBsonDocumentOrNull(options.getMin())) .max(toBsonDocumentOrNull(options.getMax())) .maxScan(options.getMaxScan()) .returnKey(options.isReturnKey()) .showRecordId(options.isShowRecordId()) .snapshot(options.isSnapshot()); }
@SuppressWarnings("deprecation") private FindOperation<DBObject> getQueryOperation(final Decoder<DBObject> decoder) { FindOperation<DBObject> operation = new FindOperation<DBObject>(collection.getNamespace(), decoder) .filter(collection.wrapAllowNull(filter)) .batchSize(findOptions.getBatchSize())
private FindOperation<BsonDocument> createExplainableQueryOperation() { FindOperation<BsonDocument> explainFindOperation = new FindOperation<BsonDocument>(namespace, new BsonDocumentCodec()); BsonDocument explainModifiers = new BsonDocument(); if (modifiers != null) { explainModifiers.putAll(modifiers); } explainModifiers.append("$explain", BsonBoolean.TRUE); return explainFindOperation.filter(filter) .projection(projection) .sort(sort) .skip(skip) .limit(Math.abs(limit) * -1) .hint(hint) .min(min) .max(max) .modifiers(explainModifiers); }
@SuppressWarnings("deprecation") private <TResult> FindOperation<TResult> createFindOperation(final MongoNamespace findNamespace, final Bson filter, final Class<TResult> resultClass, final FindOptions options) { return new FindOperation<TResult>(findNamespace, codecRegistry.get(resultClass)) .filter(filter == null ? new BsonDocument() : filter.toBsonDocument(documentClass, codecRegistry)) .batchSize(options.getBatchSize()) .skip(options.getSkip()) .limit(options.getLimit()) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .maxAwaitTime(options.getMaxAwaitTime(MILLISECONDS), MILLISECONDS) .modifiers(toBsonDocumentOrNull(options.getModifiers())) .projection(toBsonDocumentOrNull(options.getProjection())) .sort(toBsonDocumentOrNull(options.getSort())) .cursorType(options.getCursorType()) .noCursorTimeout(options.isNoCursorTimeout()) .oplogReplay(options.isOplogReplay()) .partial(options.isPartial()) .slaveOk(readPreference.isSlaveOk()) .collation(options.getCollation()) .comment(options.getComment()) .hint(toBsonDocumentOrNull(options.getHint())) .min(toBsonDocumentOrNull(options.getMin())) .max(toBsonDocumentOrNull(options.getMax())) .maxScan(options.getMaxScan()) .returnKey(options.isReturnKey()) .showRecordId(options.isShowRecordId()) .snapshot(options.isSnapshot()); }
@SuppressWarnings("deprecation") private FindOperation<DBObject> getQueryOperation(final Decoder<DBObject> decoder) { FindOperation<DBObject> operation = new FindOperation<DBObject>(collection.getNamespace(), decoder) .filter(collection.wrapAllowNull(filter)) .batchSize(findOptions.getBatchSize())