我在mongo shell中运行了以下代码:
db.unicorns.insert({name: 'Dunx', loves: ['grape', 'watermelon']});
现在我的MongoDB系列中有这样的东西:
{name: 'Dunx', loves: ['grape', 'watermelon']}
如你所见,loves
是一个array.
Question
我如何使用官方的C#驱动程序编写C#代码,实现以下功能:
db.unicorns.update({name: 'Aurora'}, {$push: {loves: 'sugar'}})
以上代码在mongo shell中运行良好.