I've run the following code in mongo shell:
db.unicorns.insert({name: 'Dunx', loves: ['grape', 'watermelon']});
and now I've something like this in my MongoDB collection:
{name: 'Dunx', loves: ['grape', 'watermelon']}
As you can see loves
is an array.
Question
How can I write C# code, with the official C# driver, that does the following:
db.unicorns.update({name: 'Aurora'}, {$push: {loves: 'sugar'}})
The above code runs just fine in mongo shell.
it should be something like this:
unicorns.Update(Query.EQ("name", "Aurora"), Update.Push("loves", "sugar"));