Esempio n. 1
0
        /// <summary>
        /// Deserializes a metadata document
        /// </summary>
        internal void Load(BsonDocument doc)
        {
            this.Name = esriBsonUtilities.BsonToString(doc.GetElement("Name"));

            // load to fields
            BsonElement bElem = doc.FirstOrDefault(x => x.Name == "Fields");

            if (default(BsonElement) != bElem)
            {
                Fields = (IFields)esriBsonUtilities.BsonToObject(bElem);
            }
            else
            {
                Fields = null;
            }

            // load extent

            bElem = doc.FirstOrDefault(x => x.Name == "Extent");
            if (default(BsonElement) != bElem)
            {
                if (bElem.Value.IsBsonBinaryData)
                {
                    Extent = (IEnvelope)esriBsonUtilities.BsonToObject(bElem);
                }
            }
            else
            {
                Extent = null;
            }
        }
Esempio n. 2
0
        public object update(object filter, object document, object options)
        {
            BsonDocument bsonDocument = document.ToBsonDocument();

            if (bsonDocument.FirstOrDefault().Name.StartsWith("$") == false) // is replace
            {
                return(replaceOne(filter, document, options));
            }

            bool?multi = options.GetProperty("multi").ToBoolOrDefault();

            if (multi.HasValue && multi.Value)
            {
                return(updateMany(filter, document, options));
            }
            else
            {
                return(updateOne(filter, document, options));
            }
        }