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

Incrementing _id field special to mongoose doesn't work #63

Open
makindiilete opened this issue Jun 21, 2019 · 1 comment
Open

Incrementing _id field special to mongoose doesn't work #63

makindiilete opened this issue Jun 21, 2019 · 1 comment

Comments

@makindiilete
Copy link

I followed your guide to do this
UserSchema = mongoose.Schema({
_id: Number,
name: String
}, { _id: false });
UserSchema.plugin(AutoIncrement);

But I keep getting error that "Cast to number failed for value " {name : Michael} " at path _id for model Hotel

@ramiel
Copy link
Owner

ramiel commented Jun 22, 2019

Can you please post more code, from the schema definition to the prt where you save the document? A minimal replicable code maybe.
There's a test in the library that shows this and I just checked and it works. Also, in your issue the error reported is Cast to number failed for value " {name : Michael} " at path _id for model Hotel but the schema seems related to Users, not Hotels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants