Beispiel #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");
        }
Beispiel #2
0
 public BsonValue(BsonValue value)
 {
     this.Type = value.Type;
     this.RawValue = value.RawValue;
 }
Beispiel #3
0
 /// <summary>
 /// Add fields in fluent api
 /// </summary>
 public BsonObject Add(string key, object value)
 {
     this[key] = new BsonValue(value);
     return this;
 }
Beispiel #4
0
 /// <summary>
 /// Add fields in fluent api
 /// </summary>
 public BsonObject Add(string key, object value)
 {
     this[key] = new BsonValue(value);
     return(this);
 }