There is obviously a document corresponding to ID in Mongoodb, but you can't find it.

clipboard.png
clipboard.png
this ID is clearly documented. Why report this error?

Apr.07,2022

if I understand it correctly, those who call mongodb should use _ id to call it.
is not clear if you just read the wrong message. I suggest you post the code for everyone's reference


.

one is ObjectId and the other is a string. How can it match?

{_id: ObjectId("5c2f336c56ea5a44884ac7a8")} // 
{_id:"5c2f336c56ea5a44884ac7a8"} // 

it is also recommended to use text instead of screenshots when asking questions. For example, 5c2f336c56ea5a44884ac7a8 I typed it out in front of the screenshot, and it doesn't make sense for everyone to waste time on it. And upstairs is also very correct, if the relevant code is not given, we are based on past experience to guess, it is very disadvantageous to solve the problem.


use _ id. {_ id: ObjectId ("5c2f336c56ea5a44884ac7a8")} is just a way to store it in the database. Actually using _ id is feasible

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e89bd5-f7d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e89bd5-f7d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?