Hi All,

I'm trying to instantiate a mongodb client and open it via emscripten::val 
but I'm already stuck at the beginning:( What I'm trying achieve first, is 
step 3 of this mongodb 
doc: https://docs.mongodb.com/getting-started/node/client/ which is this js 
oneliner: "var MongoClient = require('mongodb').MongoClient;"

In the consturctor of my c++ class I have:

js_db::js_db(){
emscripten::val require = emscripten::val::global("require");
emscripten::val mongoModule = require(std::string("mongodb"));
emscripten::val mongoClient = mongoModule.MongoClient();
//TODO: register objIDs in global objectTracker table;
}

The error I get is: "no member named 'MongoClient' in 'emscripten::val' ". 
What am I doing wrong? Why don't I get it in case of mongoModule?

What I'd like to achieve then, based on this earlier suggestion of this 
group ( 
https://groups.google.com/d/msg/emscripten-discuss/7-i5pRK7edQ/-MrCNVAuCAAJ 
) is to call mongoClient.connect() like:

void js_db::open(const std::string& db_uri){
this->db_uri=db_uri;
EM_ASM_({
var db_uri = Module.Pointer_stringify($0);
var mongoClient = objectTracker[$1];
//TODO: MongoClient.connect(db_uri, function(err, db)
},db_uri.c_str(),mongoClientObjId);
}

Thanks for any help in advance!

Best regards,
r0ller

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to