I've created a poject using yeoman and created a data base using mongodb, I have a collection called "Datos", I want to see the elements of my database on the screen, this is my code:
var express = require('express'),
router = express.Router(),
mongoose = require('mongoose'),
datos = mongoose.model('Datos');
module.exports = function(app){
app.use('/',router);
};
router.get('/BaseDatos',function(req,res,next){
db.getCollection('Datos').find(function(err,Datos){
if(err) return next(err);
res.render('index',{
titulo:'prueba',
Datos: Datos
});
});
});
I'm using jade to show the data:
extends layout
block content
h2 Sala #{Datos.Nombre}
I don't know what the problem is.
Can you help me please?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.