ToSiaqodbDocument() публичный статический Метод

public static ToSiaqodbDocument ( BsonDocument doc ) : SiaqodbDocument
doc BsonDocument
Результат SiaqodbCloudService.Models.SiaqodbDocument
Пример #1
0
        public async Task <SiaqodbDocument> Get(string bucketName, string key, string version)
        {
            var db = client.GetDatabase(DbName);

            var collection    = db.GetCollection <BsonDocument>(bucketName);
            var filterBuilder = Builders <BsonDocument> .Filter;
            var filter        = filterBuilder.Eq("_id", key);

            if (version != null)
            {
                filter = filter & filterBuilder.Eq("_rev", version);
            }

            var doc = await collection.Find(filter).FirstOrDefaultAsync();

            if (doc != null)
            {
                return(Mapper.ToSiaqodbDocument(doc));
            }
            return(null);
        }
Пример #2
0
        private void AddChangedDoc(BatchSet bs, BsonDocument doc, SyncLogItem logItem, Filter query)
        {
            if (bs.ChangedDocuments == null)
            {
                bs.ChangedDocuments = new List <SiaqodbDocument>();
            }

            var nestedDoc = doc["o"].AsBsonDocument;

            if (logItem != null && logItem.KeyVersion != null && logItem.KeyVersion.ContainsKey(nestedDoc["_id"].AsString) && logItem.KeyVersion[nestedDoc["_id"].AsString] == nestedDoc["_rev"].AsString)
            {
                return;
            }
            if (OutOfFilter(query, nestedDoc))
            {
                return;
            }
            SiaqodbDocument siaqodbDoc = Mapper.ToSiaqodbDocument(nestedDoc);

            bs.ChangedDocuments.Add(siaqodbDoc);
        }