Пример #1
0
        public bool update(Hashtable json_query, Hashtable json_update)
        {
            MongoDB.Driver.QueryDocument  _query  = new MongoDB.Driver.QueryDocument(json_query);
            MongoDB.Driver.UpdateDocument _update = new MongoDB.Driver.UpdateDocument(json_update);

            var ret = _collection.Update(_query, _update);

            return(true);
        }
Пример #2
0
        public bool update(string db, string collection, Hashtable json_query, Hashtable json_update)
        {
            var _db         = _mongoserver.GetDatabase(db);
            var _collection = _db.GetCollection <MongoDB.Bson.BsonDocument>(collection) as MongoDB.Driver.MongoCollection <MongoDB.Bson.BsonDocument>;

            MongoDB.Driver.QueryDocument  _query  = new MongoDB.Driver.QueryDocument(json_query);
            MongoDB.Driver.UpdateDocument _update = new MongoDB.Driver.UpdateDocument(json_update);

            var ret = _collection.Update(_query, _update);

            return(true);
        }
Пример #3
0
        public bool update(string db, string collection, Hashtable json_query, Hashtable json_update)
        {
            var _db         = _mongoserver.GetDatabase(db);
            var _collection = _db.GetCollection <MongoDB.Bson.BsonDocument>(collection) as MongoDB.Driver.MongoCollection <MongoDB.Bson.BsonDocument>;

            var _update_impl = new Hashtable()
            {
                { "$set", json_update }
            };

            MongoDB.Driver.QueryDocument  _query  = new MongoDB.Driver.QueryDocument(json_query);
            MongoDB.Driver.UpdateDocument _update = new MongoDB.Driver.UpdateDocument(_update_impl);

            var ret = _collection.Update(_query, _update);

            if (ret != null && ret.HasLastErrorMessage)
            {
                log.log.operation(new System.Diagnostics.StackFrame(), service.timerservice.Tick, ret.LastErrorMessage);
            }

            return(true);
        }