tags:

views:

175

answers:

1

Is it possible to execute raw commands as javascript through the Java driver for MongoDB?

I'm tired of wrapping everything in Java objects using Rhino, and would happily sacrifice performance for the convenience of passing javascript directly through to the DB.

If not, I can always use sleepymongoose or something, but I don't really want to add yet another language (python) to the stack at this point.

Any insights are appreciated.

A: 

There are 2 DB.command() methods in the mongo java driver. One of the 2 takes a String. I think this is what you are looking for.

See here

Carnell