-
Notifications
You must be signed in to change notification settings - Fork 3
Relax type requirements for primary uniqueness constraint #79
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
Conversation
…niqueness constraint
schema::Type::Scalar(BsonScalarType::ObjectId) => Some(()), | ||
_ => None, | ||
}?; | ||
let _id_field = object_type.fields.get("_id")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be validated to at least be a scalar type (and shouldn't it only be scalar types with equality?)?
What's the behaviour if the _id column is an object type? Does that break in v3-engine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MongoDB itself doesn't care. The _id
can have any type and all types are comparable. However, I don't want to potentially break the engine, so I've modified it to only allow scalar types for which we define an equality operator in the capabilities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know that _id
could be any type. But I guess if everything is schemaless it does make sense. Looks good!
Don't require _id field to have type ObjectId when generate primary uniqueness constraint
Type
(Select only one. In case of multiple, choose the most appropriate)