Mongoose always returning an empty array NodeJS

后端 未结 5 989

I have tried using find and findOne and both are not returning a document. find is returning an empty array while findOne

5条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 10:47

    const growingUnit= mongoose.model('Growing Unit', growingUnitSchema);
    

    I had a space in 'Growing Unit' on purpose and it always returned empty array. Removing that space to become 'GrowingUnit' was the fix needed in my scenario.

    const growingUnit= mongoose.model('Growing Unit', growingUnitSchema);
    

提交回复
热议问题