public override IFilteredMongoCollection <TDerivedDocument> OfType <TDerivedDocument>()
        {
            var derivedDocumentSerializer = _settings.SerializerRegistry.GetSerializer <TDerivedDocument>();
            var ofTypeSerializer          = new OfTypeSerializer <TDocument, TDerivedDocument>(derivedDocumentSerializer);
            var derivedDocumentCollection = new MongoCollectionImpl <TDerivedDocument>(_database, _collectionNamespace, _settings, _cluster, _operationExecutor, ofTypeSerializer);

            var rootOfTypeFilter = Builders <TDocument> .Filter.OfType <TDerivedDocument>();

            var renderedOfTypeFilter = rootOfTypeFilter.Render(_documentSerializer, _settings.SerializerRegistry);
            var ofTypeFilter         = new BsonDocumentFilterDefinition <TDerivedDocument>(renderedOfTypeFilter);

            return(new OfTypeMongoCollection <TDocument, TDerivedDocument>(this, derivedDocumentCollection, ofTypeFilter));
        }
        public void Setup()
        {
            var settings   = new MongoCollectionSettings();
            var dbSettings = new MongoDatabaseSettings();

            dbSettings.ApplyDefaultValues(new MongoServerSettings());
            settings.ApplyDefaultValues(dbSettings);
            _operationExecutor = new MockOperationExecutor();
            _subject           = new MongoCollectionImpl <BsonDocument>(
                new CollectionNamespace("foo", "bar"),
                settings,
                Substitute.For <ICluster>(),
                _operationExecutor);
        }
 public MongoIndexManager(MongoCollectionImpl <TDocument> collection)
 {
     _collection = collection;
 }