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