/// <summary> /// Adds a replacement document as the update modifier. /// </summary> /// <param name="nominalType">The nominal type of the replacement document</param> /// <param name="document">The document.</param> /// <returns>An UpdateWrapper.</returns> public static IMongoUpdate Replace( Type nominalType, object document ) { return(UpdateWrapper.Create(nominalType, document)); }
public void TestSerializeUpdateWrapped() { var c = new C { X = 1 }; var w = UpdateWrapper.Create(c); var json = w.ToJson(); var expected = "{ 'X' : 1 }".Replace("'", "\""); Assert.Equal(expected, json); }
public void UpdateWrapperType() { var document = new BsonDocument { { "$set", new BsonDocument { { "Age", 54 } } } }; var update = UpdateWrapper.Create(document); Console.WriteLine(update.ToBsonDocument()); }
/// <summary> /// Adds a replacement document as the update modifier. /// </summary> /// <typeparam name="TNominalType">The nominal type of the replacement document</typeparam> /// <param name="document">The document.</param> /// <returns>An UpdateWrapper.</returns> public static IMongoUpdate Replace <TNominalType>( TNominalType document ) { return(UpdateWrapper.Create <TNominalType>(document)); }