// methods internal BsonDocument CreateCommand(SemanticVersion serverVersion) { _readConcern.ThrowIfNotSupported(serverVersion); return(new BsonDocument { { "parallelCollectionScan", _collectionNamespace.CollectionName }, { "numCursors", _numberOfCursors }, { "readConcern", _readConcern.ToBsonDocument(), !_readConcern.IsServerDefault } }); }
/// <inheritdoc/> protected internal override BsonDocument CreateCommand(SemanticVersion serverVersion) { _readConcern.ThrowIfNotSupported(serverVersion); var command = base.CreateCommand(serverVersion); if (!_readConcern.IsServerDefault) { command["readConcern"] = _readConcern.ToBsonDocument(); } return(command); }
// private methods internal BsonDocument CreateCommand(SemanticVersion serverVersion) { _readConcern.ThrowIfNotSupported(serverVersion); return(new BsonDocument { { "distinct", _collectionNamespace.CollectionName }, { "key", _fieldName }, { "query", _filter, _filter != null }, { "maxTimeMS", () => _maxTime.Value.TotalMilliseconds, _maxTime.HasValue }, { "readConcern", () => _readConcern.ToBsonDocument(), !_readConcern.IsServerDefault } }); }
internal BsonDocument CreateCommand(SemanticVersion serverVersion) { _readConcern.ThrowIfNotSupported(serverVersion); return(new BsonDocument { { "geoSearch", _collectionNamespace.CollectionName }, { "near", _near, _near != null }, { "limit", () => _limit.Value, _limit.HasValue }, { "maxDistance", () => _maxDistance.Value, _maxDistance.HasValue }, { "search", _search, _search != null }, { "maxTimeMS", () => _maxTime.Value.TotalMilliseconds, _maxTime.HasValue }, { "readConcern", _readConcern.ToBsonDocument(), !_readConcern.IsServerDefault } }); }
private IReadOperation <IAsyncCursor <TDocument> > CreateOperation(SemanticVersion serverVersion) { var hasExplainModifier = _modifiers != null && _modifiers.Contains("$explain"); if (SupportedFeatures.IsFindCommandSupported(serverVersion) && !hasExplainModifier) { return(CreateFindCommandOperation()); } else { // this is here because FindOpcodeOperation doesn't support // read concern _readConcern.ThrowIfNotSupported(serverVersion); return(CreateFindOpcodeOperation()); } }
internal BsonDocument CreateCommand(SemanticVersion serverVersion) { _readConcern.ThrowIfNotSupported(serverVersion); return(new BsonDocument { { "geoNear", _collectionNamespace.CollectionName }, { "near", _near, _near != null }, { "limit", () => _limit.Value, _limit.HasValue }, { "maxDistance", () => _maxDistance.Value, _maxDistance.HasValue }, { "query", _filter, _filter != null }, { "spherical", () => _spherical.Value, _spherical.HasValue }, { "distanceMultiplier", () => _distanceMultiplier.Value, _distanceMultiplier.HasValue }, { "includeLocs", () => _includeLocs.Value, _includeLocs.HasValue }, { "uniqueDocs", () => _uniqueDocs.Value, _uniqueDocs.HasValue }, { "maxTimeMS", () => _maxTime.Value.TotalMilliseconds, _maxTime.HasValue }, { "readConcern", _readConcern.ToBsonDocument(), !_readConcern.IsServerDefault } }); }
// methods private BsonDocument CreateCommand(ServerDescription serverDescription, ReadPreference readPreference) { _readConcern.ThrowIfNotSupported(serverDescription.Version); var firstBatchSize = _firstBatchSize ?? (_batchSize > 0 ? _batchSize : null); var readPreferenceDocument = QueryHelper.CreateReadPreferenceDocument(serverDescription.Type, readPreference); var isShardRouter = serverDescription.Type == ServerType.ShardRouter; var command = new BsonDocument { { "find", _collectionNamespace.CollectionName }, { "filter", _filter, _filter != null }, { "sort", _sort, _sort != null }, { "projection", _projection, _projection != null }, { "hint", _hint, _hint != null }, { "skip", () => _skip.Value, _skip.HasValue }, { "limit", () => Math.Abs(_limit.Value), _limit.HasValue&& _limit != 0 }, { "batchSize", () => firstBatchSize.Value, firstBatchSize.HasValue }, { "singleBatch", () => _limit < 0 || _singleBatch.Value, _limit < 0 || _singleBatch.HasValue }, { "comment", _comment, _comment != null }, { "maxScan", () => _maxScan.Value, _maxScan.HasValue }, { "maxTimeMS", () => _maxTime.Value.TotalMilliseconds, _maxTime.HasValue }, { "readPreference", readPreferenceDocument, readPreferenceDocument != null }, { "max", _max, _max != null }, { "min", _min, _min != null }, { "returnKey", () => _returnKey.Value, _returnKey.HasValue }, { "showRecordId", () => _showRecordId.Value, _showRecordId.HasValue }, { "snapshot", () => _snapshot.Value, _snapshot.HasValue }, { "tailable", true, _cursorType == CursorType.Tailable || _cursorType == CursorType.TailableAwait }, { "oplogReplay", () => _oplogReplay.Value, _oplogReplay.HasValue }, { "noCursorTimeout", () => _noCursorTimeout.Value, _noCursorTimeout.HasValue }, { "awaitData", true, _cursorType == CursorType.TailableAwait }, { "allowPartialResults", () => _allowPartialResults.Value, _allowPartialResults.HasValue&& isShardRouter }, { "readConcern", () => _readConcern.ToBsonDocument(), !_readConcern.IsServerDefault } }; return(command); }