Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters #4708

Closed
AraanBranco opened this issue Nov 14, 2016 · 3 comments

Comments

@AraanBranco
Copy link

AraanBranco commented Nov 14, 2016

I have an application running, and I had some problems when I make a find in a string (even though it is an ObjectId), I already tried to convert the String to ObjectId with mongoose.Types.ObjectId(' 53cb6b9b4f4ddef1ad47f943 ') (example) and Even then I can not get the return and it returns me the following error:

Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters

Also returns me:

this.id.charCodeAt is not a function

Has anyone had this problem yet?

@cblanc
Copy link
Contributor

cblanc commented Nov 15, 2016

Try trimming the spaces in your string

mongoose.Types.ObjectId ('53cb6b9b4f4ddef1ad47f943')

@AraanBranco
Copy link
Author

Sorry, it was typing error ... neat =)

@Bikashm977
Copy link

hi i m bikash

@Automattic Automattic locked as resolved and limited conversation to collaborators May 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants