Hi All,
I originally tried to access a mongodb instance by using a normal mongodb
nodejs module but I guess due to the async callbacks my c++ program failed
earlier due to the result not getting back in time and/or the c++ part not
being organized into callbacks as it's usually done in node js. So I just
picked a wrapped mongodb driver module called mongomery which stated being
sync but I have the same issue -I guess it's still the async callback issue
under the hood (yield). This tiny piece of js works fine purely in node but
not if it's embedded in c++ in an EM_ASM block:
var mongomery = require('mongomery');
mongomery(function*(mongo) {
var url = 'mongodb://myuser:myuri/mydb',
db = yield mongo.connect(url),
collection = db.collection('entries'),
docs = yield collection.find({}).toArray();
docs.forEach(function(item) {
console.log(item);
});
console.log(db);
db.close();
}).on('error', function(error) {
console.log(error.message);
});
Does anyone know how to come over this problem without reorganizing the c++
part into js style callbacks? The reason against reengineering the c++ code
is that it is a library code which is also used on android (where the db
handling is done via jni calls to use android's sqlite) and in desktop
environment (where it's just using the normal C sqlite lib) but both of
them using sync I/O. Thanks for the hints 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 [email protected].
For more options, visit https://groups.google.com/d/optout.