How do I execute a MongoDB query in a native node-mongo-native driver?

is there a way to pass a MongoDB request, for example db.things.find()

directly to the Mongo C driver or the node-mongo-native Javascript driver, to make the request?

I am wondering how a native driver can evaluate the request and return the result.

How to do it?

Thank!

+2


source to share


1 answer


The mongo_simple_str_command (...) method in mongo.h seems to be what you are looking for.

mongo_simple_str_command(conn, db, "$eval", "db.foo.find()", out);

      



I found a usage example here: https://github.com/mongodb/mongo-c-driver/blob/master/test/platform/linux/timeouts.c

+3


source







All Articles