public IDocumentUpdateBuilder PullFilter(string arrayProperty, Func <IDocumentFilterBuilder, object> filter = null)
        {
            var filterBuilder = new MongoDocumentFilterBuilder <TDocument>();

            _updates.Add(InternalBuilder.PullFilter(arrayProperty, filterBuilder.CreateMongoFilter(filter)));
            return(this);
        }
Exemplo n.º 2
0
        public IDocumentProjectionBuilder Match(string arrayProperty, Func <IDocumentFilterBuilder, object> filter = null)
        {
            var filterBuilder = new MongoDocumentFilterBuilder <TDocument>();

            _projections.Add(InternalBuilder.ElemMatch(arrayProperty, filterBuilder.CreateMongoFilter(filter)));
            return(this);
        }
        public IDocumentUpdateBuilder <TDocument> PullFilter <TItem>(Expression <Func <TDocument, IEnumerable <TItem> > > arrayProperty, Expression <Func <TItem, bool> > filter = null)
        {
            var filterBuilder = new MongoDocumentFilterBuilder <TItem>();

            _updates.Add(InternalBuilder.PullFilter(arrayProperty, filterBuilder.CreateMongoFilter(filter)));
            return(this);
        }
        public MongoDocumentStorageProvider(MongoConnection connection, string documentType)
        {
            DocumentType = documentType;

            _collection    = new Lazy <IMongoCollection <DynamicWrapper> >(() => connection.GetDatabase().GetCollection <DynamicWrapper>(documentType));
            _filterBuilder = new MongoDocumentFilterBuilder <DynamicWrapper>();
        }
        public static IEnumerable <WriteModel <TDocument> > CreateMongoBulk(MongoDocumentFilterBuilder <TDocument> filterBuilder, Action <IDocumentBulkBuilder <TDocument> > requests)
        {
            var builder = new MongoDocumentBulkBuilderGeneric <TDocument>(filterBuilder);

            requests?.Invoke(builder);

            return(builder._operations);
        }
        public static IEnumerable <WriteModel <DynamicWrapper> > CreateMongoBulk(MongoDocumentFilterBuilder <DynamicWrapper> filterBuilder, Action <IDocumentBulkBuilder> requests)
        {
            var builder = new MongoDocumentBulkBuilder(filterBuilder);

            requests?.Invoke(builder);

            return(builder._operations);
        }
        public MongoDocumentStorageProvider(MongoConnection connection, string documentType = null)
        {
            if (string.IsNullOrEmpty(documentType))
            {
                documentType = MongoHelpers.GetDefaultDocumentType <TDocument>();
            }

            DocumentType = documentType;

            _database      = new Lazy <IMongoDatabase>(connection.GetDatabase);
            _collection    = new Lazy <IMongoCollection <TDocument> >(() => _database.Value.GetCollection <TDocument>(documentType));
            _filterBuilder = new MongoDocumentFilterBuilder <TDocument>();
        }
 private MongoDocumentBulkBuilderGeneric(MongoDocumentFilterBuilder <TDocument> filterBuilder = null)
 {
     _filterBuilder = filterBuilder;
 }
 private MongoDocumentBulkBuilder(MongoDocumentFilterBuilder <DynamicWrapper> filterBuilder = null)
 {
     _filterBuilder = filterBuilder;
 }