예제 #1
0
        public BsonDocument(BsonValue value)
            : base(value.AsObject.RawValue)
        {
            if (!this.HasKey("_id")) throw new ArgumentException("BsonDocument must have an _id key");

            this.Id = this["_id"].RawValue;
            this.RemoveKey("_id");
        }
예제 #2
0
 public BsonValue(BsonValue value)
 {
     this.Type = value.Type;
     this.RawValue = value.RawValue;
 }
예제 #3
0
 /// <summary>
 /// Add fields in fluent api
 /// </summary>
 public BsonObject Add(string key, object value)
 {
     this[key] = new BsonValue(value);
     return this;
 }
예제 #4
0
 /// <summary>
 /// Add fields in fluent api
 /// </summary>
 public BsonObject Add(string key, object value)
 {
     this[key] = new BsonValue(value);
     return(this);
 }