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
URGENT 5.2.0: _Cannot specify a custom index on _id
, MongoDB does not allow overwriting the default _id
index_ is not correctly implemented
#6650
Comments
_id
, MongoDB does not allow overwriting the default _id
index_id
, MongoDB does not allow overwriting the default _id
index is not correctly implemented
_id
, MongoDB does not allow overwriting the default _id
index is not correctly implemented_id
, MongoDB does not allow overwriting the default _id
index is not correctly implemented
_id
, MongoDB does not allow overwriting the default _id
index is not correctly implemented_id
, MongoDB does not allow overwriting the default _id
index_ is not correctly implemented
I agree this should not raise an error, at least not in a minor release. Perhaps emitting an error would be more suitable? However: Does compound indexes with |
|
@jlchereau thanks for the clarification and sorry about the trouble. We'll convert this to printing a warning if an index only has |
In my opinion, you can keep throwing an error, but only when:
|
I think that's the case as well, but I'm going to err on the side of caution. When you make a mistake, there's very rarely just one mistake, so for now we'll keep it as a warning and consider adding the error back later if there aren't any issues with the warning. |
5.2.0 took a too restrictive measure to fix #6605:
With 5.2.0, any index containing _id: 1 raises an error because of https://github.com/Automattic/mongoose/blob/master/lib/model.js#L1208
should be replaced with something like
The text was updated successfully, but these errors were encountered: