Argument passed in must be a string of 24 hex characters - I think it is

后端 未结 6 2140
我寻月下人不归
我寻月下人不归 2020-12-18 19:40

I have a method to find a document in my database based on its ObjectID:

      console.log(\'id: \' + id + \' type: \' + typeof id);
      collection.findOne         


        
6条回答
  •  北海茫月
    2020-12-18 20:03

    Yeah, I just spent thirty minutes baffled by this. If anyone finds themselves here, first check if you even need to convert to ObjectID in the first place. Like OP, I forgot that the hexstring is logged as just that - a hexstring.

提交回复
热议问题