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?
Check your mongodb database, if _id is storaged as String, findById(id) can not found id. FindById(id) only finds ObjectId('yourId'). You might import database by using mongoimport and including _id in JSON, it's wrong, delete _id in imported JSON.
_id
findById(id)
id
FindById(id)
finds ObjectId('yourId')