Find one document and update the value to specified document in MongoDB using C#, in MongoDB driver 2.0 FindOneAndUpdateAsync() is the method used achieve find and replace functionality in MongoDB.

In the below example MasterIds is the collection name and MasterID is the column name where am updating 1110 with 1120

C#:  .Net 4.5 & MongoDB 2.0

using System;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver.Core;
using MongoDB.Driver;

namespace FindAnd
    class Program
        static void Main(string[] args)

        static async Task callMain(string[] args)
            var conString = "mongodb://localhost:27017";
            var Client = new MongoClient(conString);
            var DB = Client.GetDatabase("test");
            var collection = DB.GetCollection<BsonDocument>("MasterIds");

            //find the MasterID with 1130 and replace it with 1120
            var result = await collection.FindOneAndUpdateAsync(
                                Builders<BsonDocument>.Filter.Eq("MasterID", 1110),
                                Builders<BsonDocument>.Update.Set("MasterID", 1120)

            //retrive the data from collection
            await collection.Find(new BsonDocument())
             .ForEachAsync(x => Console.WriteLine(x));