1

I am not deep in working with MongoDB. But i want to use it with C# driver. I guess that not all features can be available in this driver (Am i right?). Or for example, it easy to find some code written on javascript and, so, it seems easy to use it without mapping/finding appropriate methods in C# driver. I know that MongoDB is written on C++, but as i understand that the main/native driver language is javascript. So i am interesting in how can i run javascript from C# for working with MongoDB? and does this help in getting all features from MongoDB? If it does, tell me please, how to embed and run javascript in C#? Of course, i need fast and easy to use realization, you know;)))))

Edit: which driver will be faster: C# or JavaScript?

Joshua Partogi
  • 16,167
  • 14
  • 53
  • 75
Edward83
  • 6,664
  • 14
  • 74
  • 102
  • 1
    Assuming you are using [this](http://github.com/samus/mongodb-csharp) C# driver, [here](http://github.com/samus/mongodb-csharp/blob/master/examples/Simple/Main.cs) is an example of how to use it from C# (no JavaScript required). – Sasha Chedygov Oct 27 '10 at 00:00

2 Answers2

2

Most of the functionality should be made available at the C# level by the driver. If, however, you want to do some more advanced queries, like a map-reduce, you're sort of stuck with writing some Javascript - it's like writing SQL for an RDBMS.

Sean McSomething
  • 6,376
  • 2
  • 23
  • 28
2

I just wanted to update this since there's a lot more functionality in the C# driver now and, where there is not, you can try using NoRM (NoRM on Github) or reviewing the source code for some inspiration. Note that this is not the official driver so don't expect support from 10gen if you have a support contract (although I have seen members of the 10gen team actively helping out in the NoRM user group).

Jordan
  • 5,085
  • 7
  • 34
  • 50
  • I should mention that there are some other great drivers out there other than NoRM (Samus, for example - also available with source code). NoRM and Samus are simply the two with which I am most familiar. – Jordan Jun 07 '11 at 19:09