Mongoose findbyid() return null

前端 未结 5 856
时光取名叫无心
时光取名叫无心 2021-01-13 01:04

I am trying to find a record in my mongo db by its id

No matter I use findbyid(), findone(id,...), it return null

here is my code. what is the solution?

5条回答
  •  旧时难觅i
    2021-01-13 01:41

    In my case, the imported file used to have the _id column as string, so it was messing the DB and I was no able to filter using that column.

    Once I deleted the collection, removed the _id column from data file and re-imported it, the _id filtering started working fine.

提交回复
热议问题