I am new to mongoose and I was trying a few basic things with express. The data isn't being retrieved in the format of the schema. It includes the id and another value not the first name or the last name. The post seems to work fine. Can anyone help me out in this?
var entrySchema = new Schema({
firstname: String,
lastname: String
});
var Entry = mongoose.model('Entry', entrySchema);
/* GET home page. */
router.get("/",function(req,res,next){
Entry.find(function(err,entries){
if(err)
{
res.send(err);
}
res.send(entries);
})
})
router.post("/",function(req,res){
var entry = new Entry();
entry.firstname = req.body.firstname;
entry.lastname = req.body.lastname;
entry.save(function(err){
if(err){
res.send(err);
}
res.send({message: "success"});
});
})