Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using MongoDB shell commands on MongoDB 10Gen's driver

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 } } );

I am not sure how can i do this. I am not interested in how to do via high level api classes.

like image 648
AnyOne Avatar asked Oct 09 '22 15:10

AnyOne


1 Answers

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.

If you want to run mongo shell commands then run them in the mongo shell.

like image 188
Robert Stam Avatar answered Oct 13 '22 12:10

Robert Stam