Can't access object property of a Mongoose response

后端 未结 3 1666
情歌与酒
情歌与酒 2020-12-03 18:55

I\'m running this code on node.js

var mongoose = require(\'mongoose\');
mongoose.model(\'participant\',new mongoose.Schema({},{ collection : \'forumParticipa         


        
3条回答
  •  甜味超标
    2020-12-03 19:13

    Partipant.find({entity_id: 0})
    

    The above find() returns the array of documents from DB

    You can access the value of each record

    docs.map((d)=>{
        console.log(d.get('user_id'))
    })
    

提交回复
热议问题