node.js - Unable to find result on ejs template when i passed json array to ejs template -


pplease how can print results of every user on ejs template.

router.get('/', function(req, res, next) {     var resultarray=[];     mongo.connect(url, function (err, db) {         assert.equal(err, null);         var cursor = db.collection('user-data').find();         cursor.foreach(function (err, data) {             assert(err, null);             resultarray.push(data);         },function () {             db.close();             res.render('user-details', { items: resultarray, title:'user details' });         });     });  }); 

this code used send json array able find length of array unable print results.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -