Mongoose use of .select() method

前端 未结 9 1657
孤城傲影
孤城傲影 2020-12-14 14:16

I\'m pretty confused with the use of the select method. This is how I use it, and it\'s wrong:

Transaction.find({username : user.username}).sele         


        
9条回答
  •  我在风中等你
    2020-12-14 14:49

    To retrieve certain fields without retrieving the '_id' you can specify to exclude it

    Model.find({}, {'Username':1, '_id':0}, function ( err, docs ){}.....
    

提交回复
热议问题