V
V
Vladimir2016-11-04 16:18:06
JavaScript
Vladimir, 2016-11-04 16:18:06

How to output data from MongoDB to textarea?

I work on node.js with Mongodb, outputting data to the console is good. To output to the console, I write:
var findClient = function(db, callback) {
var cursor =db.collection('client').find( );
cursor.each(function(err, doc) {
assert.equal(err, null);
if (doc != null) {
console.log(doc);
} else {
callback();
}
});
};
MongoClient.connect(url, function(err, db) {
assert.equal(null, err);
findClient(db, function() {
db.close();
});
});
Tell me how you can output data from MongoDB to a textarea or another HTML field/element.
tried via document.getElementById('output').value =doc; does not exceed.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
n7olkachev, 2016-11-04
@n7olkachev

document.getElementById('output').value =doc;where did you write this code?

I
Ivan Leshchenko, 2016-11-04
@inkluter

document.getElementById('output').innerHTML = doc;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question