本文整理汇总了C#中CollectionNamespace类的典型用法代码示例。如果您正苦于以下问题:C# CollectionNamespace类的具体用法?C# CollectionNamespace怎么用?C# CollectionNamespace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CollectionNamespace类属于命名空间,在下文中一共展示了CollectionNamespace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QueryMessage
// constructors
/// <summary>
/// Initializes a new instance of the <see cref="QueryMessage"/> class.
/// </summary>
/// <param name="requestId">The request identifier.</param>
/// <param name="collectionNamespace">The collection namespace.</param>
/// <param name="query">The query.</param>
/// <param name="fields">The fields.</param>
/// <param name="queryValidator">The query validator.</param>
/// <param name="skip">The number of documents to skip.</param>
/// <param name="batchSize">The size of a batch.</param>
/// <param name="slaveOk">if set to <c>true</c> it is OK if the server is not the primary.</param>
/// <param name="partialOk">if set to <c>true</c> the server is allowed to return partial results if any shards are unavailable.</param>
/// <param name="noCursorTimeout">if set to <c>true</c> the server should not timeout the cursor.</param>
/// <param name="oplogReplay">if set to <c>true</c> the OplogReplay bit will be set.</param>
/// <param name="tailableCursor">if set to <c>true</c> the query should return a tailable cursor.</param>
/// <param name="awaitData">if set to <c>true</c> the server should await data (used with tailable cursors).</param>
/// <param name="shouldBeSent">A delegate that determines whether this message should be sent.</param>
public QueryMessage(
int requestId,
CollectionNamespace collectionNamespace,
BsonDocument query,
BsonDocument fields,
IElementNameValidator queryValidator,
int skip,
int batchSize,
bool slaveOk,
bool partialOk,
bool noCursorTimeout,
bool oplogReplay,
bool tailableCursor,
bool awaitData,
Func<bool> shouldBeSent = null)
: base(requestId, shouldBeSent)
{
_collectionNamespace = Ensure.IsNotNull(collectionNamespace, nameof(collectionNamespace));
_query = Ensure.IsNotNull(query, nameof(query));
_fields = fields; // can be null
_queryValidator = Ensure.IsNotNull(queryValidator, nameof(queryValidator));
_skip = Ensure.IsGreaterThanOrEqualToZero(skip, nameof(skip));
_batchSize = batchSize; // can be negative
_slaveOk = slaveOk;
_partialOk = partialOk;
_noCursorTimeout = noCursorTimeout;
_oplogReplay = oplogReplay;
_tailableCursor = tailableCursor;
_awaitData = awaitData;
}
示例2: AggregateFluentBucketTests
// static constructor
static AggregateFluentBucketTests()
{
var databaseNamespace = DriverTestConfiguration.DatabaseNamespace;
__database = DriverTestConfiguration.Client.GetDatabase(databaseNamespace.DatabaseName);
__collectionNamespace = DriverTestConfiguration.CollectionNamespace;
__ensureTestData = new Lazy<bool>(CreateTestData);
}
示例3: Setup
public void Setup()
{
_collectionNamespace = new CollectionNamespace("foo", "bar");
_fieldName = "a.b";
_messageEncoderSettings = new MessageEncoderSettings();
_valueSerializer = new Int32Serializer();
}
示例4: BulkDeleteOperationEmulator
// constructors
public BulkDeleteOperationEmulator(
CollectionNamespace collectionNamespace,
IEnumerable<DeleteRequest> requests,
MessageEncoderSettings messageEncoderSettings)
: base(collectionNamespace, requests, messageEncoderSettings)
{
}
示例5: BulkUpdateOperation
// constructors
public BulkUpdateOperation(
CollectionNamespace collectionNamespace,
IEnumerable<UpdateRequest> requests,
MessageEncoderSettings messageEncoderSettings)
: base(collectionNamespace, requests, messageEncoderSettings)
{
}
示例6: DriverTestConfiguration
// static constructor
static DriverTestConfiguration()
{
var connectionString = CoreTestConfiguration.ConnectionString.ToString();
var mongoUrl = new MongoUrl(connectionString);
var clientSettings = MongoClientSettings.FromUrl(mongoUrl);
if (!clientSettings.WriteConcern.IsAcknowledged)
{
clientSettings.WriteConcern = WriteConcern.Acknowledged; // ensure WriteConcern is enabled regardless of what the URL says
}
var serverSelectionTimeoutString = Environment.GetEnvironmentVariable("MONGO_SERVER_SELECTION_TIMEOUT_MS");
if (serverSelectionTimeoutString == null)
{
serverSelectionTimeoutString = "10000";
}
clientSettings.ServerSelectionTimeout = TimeSpan.FromMilliseconds(int.Parse(serverSelectionTimeoutString));
clientSettings.ClusterConfigurator = cb =>
{
var traceSource = new TraceSource("mongodb-tests", SourceLevels.Information);
traceSource.Listeners.Clear(); // remove the default listener
var listener = new ConsoleTraceListener();
traceSource.Listeners.Add(listener);
cb.TraceWith(traceSource);
};
__client = new MongoClient(clientSettings);
__databaseNamespace = mongoUrl.DatabaseName == null ? CoreTestConfiguration.DatabaseNamespace : new DatabaseNamespace(mongoUrl.DatabaseName);
__collectionNamespace = new CollectionNamespace(__databaseNamespace, "testcollection");
}
示例7: MapReduceOperationBase
// constructors
/// <summary>
/// Initializes a new instance of the <see cref="MapReduceOperationBase"/> class.
/// </summary>
/// <param name="collectionNamespace">The collection namespace.</param>
/// <param name="mapFunction">The map function.</param>
/// <param name="reduceFunction">The reduce function.</param>
/// <param name="messageEncoderSettings">The message encoder settings.</param>
protected MapReduceOperationBase(CollectionNamespace collectionNamespace, BsonJavaScript mapFunction, BsonJavaScript reduceFunction, MessageEncoderSettings messageEncoderSettings)
{
_collectionNamespace = Ensure.IsNotNull(collectionNamespace, nameof(collectionNamespace));
_mapFunction = Ensure.IsNotNull(mapFunction, nameof(mapFunction));
_reduceFunction = Ensure.IsNotNull(reduceFunction, nameof(reduceFunction));
_messageEncoderSettings = Ensure.IsNotNull(messageEncoderSettings, nameof(messageEncoderSettings));
}
示例8: MapReduceOperationBase
// constructors
protected MapReduceOperationBase(CollectionNamespace collectionNamespace, BsonJavaScript mapFunction, BsonJavaScript reduceFunction, BsonDocument query, MessageEncoderSettings messageEncoderSettings)
{
_collectionNamespace = Ensure.IsNotNull(collectionNamespace, "collectionNamespace");
_mapFunction = Ensure.IsNotNull(mapFunction, "mapFunction");
_reduceFunction = Ensure.IsNotNull(reduceFunction, "reduceFunction");
_query = query;
_messageEncoderSettings = messageEncoderSettings;
}
示例9: TestFixtureSetUp
public override void TestFixtureSetUp()
{
base.TestFixtureSetUp();
// override this database and collection using special ones for this...
_databaseNamespace = new DatabaseNamespace("DatabaseExistsOperationTests");
_collectionNamespace = new CollectionNamespace(_databaseNamespace, "DatabaseExistsOperationTests");
}
示例10: BulkUnmixedWriteOperationEmulatorBase
// constructors
protected BulkUnmixedWriteOperationEmulatorBase(
CollectionNamespace collectionNamespace,
IEnumerable<WriteRequest> requests,
MessageEncoderSettings messageEncoderSettings)
{
_collectionNamespace = Ensure.IsNotNull(collectionNamespace, nameof(collectionNamespace));
_requests = Ensure.IsNotNull(requests, nameof(requests));
_messageEncoderSettings = messageEncoderSettings;
}
示例11: AggregateOperationBase
// constructors
protected AggregateOperationBase(
CollectionNamespace collectionNamespace,
IEnumerable<BsonDocument> pipeline,
MessageEncoderSettings messageEncoderSettings)
{
_collectionNamespace = Ensure.IsNotNull(collectionNamespace, "collectionNamespace");
_pipeline = Ensure.IsNotNull(pipeline, "pipeline").ToList();
_messageEncoderSettings = messageEncoderSettings;
}
示例12: UpdateOpcodeOperationEmulator
// constructors
public UpdateOpcodeOperationEmulator(
CollectionNamespace collectionNamespace,
UpdateRequest request,
MessageEncoderSettings messageEncoderSettings)
{
_collectionNamespace = Ensure.IsNotNull(collectionNamespace, "collectionNamespace");
_request = Ensure.IsNotNull(request, "request");
_messageEncoderSettings = Ensure.IsNotNull(messageEncoderSettings, "messageEncoderSettings");
}
示例13: DeleteOpcodeOperationEmulator
// constructors
public DeleteOpcodeOperationEmulator(
CollectionNamespace collectionNamespace,
BsonDocument criteria,
MessageEncoderSettings messageEncoderSettings)
{
_collectionNamespace = Ensure.IsNotNull(collectionNamespace, "collectionNamespace");
_criteria = Ensure.IsNotNull(criteria, "criteria");
_messageEncoderSettings = messageEncoderSettings;
}
示例14: UpdateOpcodeOperationEmulator
// constructors
public UpdateOpcodeOperationEmulator(
CollectionNamespace collectionNamespace,
UpdateRequest request,
MessageEncoderSettings messageEncoderSettings)
{
_collectionNamespace = Ensure.IsNotNull(collectionNamespace, nameof(collectionNamespace));
_request = Ensure.IsNotNull(request, nameof(request));
_messageEncoderSettings = Ensure.IsNotNull(messageEncoderSettings, nameof(messageEncoderSettings));
}
示例15: GetMoreMessage
// constructors
/// <summary>
/// Initializes a new instance of the <see cref="GetMoreMessage"/> class.
/// </summary>
/// <param name="requestId">The request identifier.</param>
/// <param name="collectionNamespace">The collection namespace.</param>
/// <param name="cursorId">The cursor identifier.</param>
/// <param name="batchSize">The size of a batch.</param>
public GetMoreMessage(
int requestId,
CollectionNamespace collectionNamespace,
long cursorId,
int batchSize)
: base(requestId)
{
_collectionNamespace = Ensure.IsNotNull(collectionNamespace, "collectionNamespace");
_cursorId = cursorId;
_batchSize = Ensure.IsGreaterThanOrEqualToZero(batchSize, "batchSize");
}