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

_id in the schema causing trouble? #15

Closed
benflinn opened this issue Aug 20, 2018 · 3 comments
Closed

_id in the schema causing trouble? #15

benflinn opened this issue Aug 20, 2018 · 3 comments

Comments

@benflinn
Copy link

I get this error:

Unhandled rejection MongoError: The field 'background' is not valid for an _id index specification. Specification: { v: 2, ns: "app.bruteforce", key: { _id: 1 }, name: "_id_1", background: true, unique: false }

but it goes away if I delete the _id field in the schema?

@benflinn
Copy link
Author

also: this didn't happen before i updated mongoose to the latest version. went from mongoose 4.11.5 to 4.13.15

@Martii
Copy link

Martii commented Aug 26, 2018

Doesn't seem to be present in mongoose@5.2.9 with our usage.

@cbargren
Copy link
Owner

cbargren commented Feb 1, 2019

Sorry for the long delay, haven't been watching this repo very closely.

This seems to be that you're defining an index on the _id field, which you shouldn't do: Automattic/mongoose#5014 https://stackoverflow.com/questions/42378032/mongodb-3-4-2-invalidindexspecificationoption-error-the-field-unique-is-not-v/42383148

If that's not the case and you're still having this problem, reopen the ticket with the mongoose and mongodb versions you're having trouble with. Cheers!

@cbargren cbargren closed this as completed Feb 1, 2019
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

3 participants