i am using for loop to retrieve the data from mongodb and display it on the browser but the problem it it iterates only for the first time and stops. So i get only the first entry as the output. Whereas it gives the correct output in the console log. Please help?
var movieSchema1 = new mongoose.Schema({
name:String,
address:String,
location:String
});
var user=mongoose.model('movie', movieSchema1, 'movie');
for (var i = 0; i < user.length; i++) {
res.json("iteration " + i);
res.json('name:' + user[i].name + user[i].address);
}