在MongoDB的10gen公司的司机使用MongoDB的shell命令 [英] Using MongoDB shell commands on MongoDB 10Gen's driver
问题描述
我想简单地通过MongoDB的10gen公司的.NET执行纯粹的MongoDB查询(C#)的驱动程序。
I want to simply execute pure MongoDB queries via MongoDb 10Gen's .net(c#) driver.
例如。我想在驱动程序使用下面的命令
For example . I want to use below command on driver
db.people.update( { name:"Joe" }, { $inc: { n : 1 } } );
我不知道我怎么能做到这一点。我不感兴趣,如何通过高层次的API类做的。
I am not sure how can i do this. I am not interested in how to do via high level api classes.
推荐答案
C#的驱动程序(或任何其他驱动程序),不适合在直接蒙戈运行shell命令。这就是shell是什么。你需要做的是翻译蒙戈shell命令成等价的C#语句。
The C# driver (or any other driver) is not intended to "directly" run mongo shell commands. That's what the shell is for. What you need to do is translate the mongo shell commands into the equivalent C# statements.
如果你想运行蒙戈shell命令,然后在蒙戈shell中运行它们。
If you want to run mongo shell commands then run them in the mongo shell.
这篇关于在MongoDB的10gen公司的司机使用MongoDB的shell命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!