views:

178

answers:

3

I am new to MongoDB and have a perfect place in mind to use it. However, it's only worth it if I can make the queries from JavaScript and return JSON. I read another post on here of someone asking a similar question, but not specific to C#.

What's the easiest way I can implement a generic service/handler in asp.net/c# that would allow me to interact with mongodb via JavaScript? I understand JavaScript can't call mongodb directly, so the next best thing is what I'm looking for.

A: 

Although this is entirely dependent on the Mongo driver you use the "easiest" way is to pass strings to a controller that hits your mongo driver's "raw" mode.

The interesting part is going to be passing queries around. Are you really going to create javascript functions with javascript?

jfar
I was hoping for a mongo console like experience using client-side scripting. I have a fully JavaScript front-end and would love to skip writing server-side code to interact with the database. However, based on my options, you are right. It doesn't makes sense to approach it this way. I'm better off using REST.Thanks anyways!
JohnAgan
A: 

javascript support http://www.mongodb.org/display/DOCS/Javascript+Language+Center

Theo
A: 

OK, if you want to use Javascript from the web page, then you can use a REST wrapper.

There are a couple: Christina's (she works for 10gen), tdegrunt's. They may not be IIS-friendly.

Gates VP