How to use mongoose findOne

前端 未结 5 1674
死守一世寂寞
死守一世寂寞 2020-12-01 07:32

I have the below schema (apologies that it is in coffeescript)

Schema = mongoose.Schema

AuthS = new Schema
    auth:   {type: String, unique: true}
    nick         


        
5条回答
  •  醉话见心
    2020-12-01 07:53

    Found the problem, need to use function(err,obj) instead:

    Auth.findOne({nick: 'noname'}, function(err,obj) { console.log(obj); });
    

提交回复
热议问题