Nodejs + Moongose + Typescript

Asked

Viewed 20 times

-1

I’m new to development with Nodejs and I’m having a problem.

I have an Array of an obj whose Id is type Objectid from Mongo.

I’m trying to make a find inside this Array by searching for that Id. And it’s not working. Here’s my attempt:

inserir a descrição da imagem aqui

Could someone please help me?

Thank you in advance.

  • This _id expects a String if I’m not mistaken. Checks if the type you’re passing/comparing is String...

  • I converted the two values to String and it worked! If you want to answer this question I give the vote here. Thanks

1 answer

0


The _id expects a String. You need to define its type as a String.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.