0

How to update a document on a whole in mongodb using c# driver(2.4.4)

protected static IMongoClient _client;
            protected static IMongoDatabase _database;
            protected static IMongoCollection<UserSetting> _collection;

            public DataAccess()
            {
                _client = new MongoClient("mongodb://localhost:27017");
                _database = _client.GetDatabase("usersettings");
                _collection = _database.GetCollection<UserSetting>("settings");
            }

             public void SaveSetting(int Id, UserSetting setting)
            {
                setting.UserID = Id;
                var settingsForID = _database.GetCollection<UserSetting>("settings").AsQueryable<UserSetting>().Where(c => c.UserID == Id);

            }
wandermonk
  • 6,856
  • 6
  • 43
  • 93
  • What have you tried? What do you have? What do you expect? There is more than just one possible way you know. – Neil Lunn Jun 23 '17 at 08:27
  • Also see the Official Documentation Guides; [Update Data with C# Driver](https://docs.mongodb.com/getting-started/csharp/update/) – Neil Lunn Jun 23 '17 at 08:32

0 Answers0