-
Notifications
You must be signed in to change notification settings - Fork 87
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
Primary keys should allow to be nullable #458
Comments
Or should we ? |
We should 😄 |
I would like to understand more. Even though core supports it why would we allowing this. I would argue this in 110% of the cases is a mistake when defining the schema. What's the use case we are trying to cover? |
The @PrimaryKey() is the UID for the DB document (https://www.mongodb.com/docs/realm/sdk/flutter/realm-database/define-realm-object-schema/#primarykey) so can not be null - how would we uniquely identify each DB document otherwise? It would be good as @blagoev mentioned to hear the full use case. |
|
It would be good to understand the use case of having a null @PrimaryKey() DB document UID. Within our firm we always use unique ObjectID's for UIDs in order to keep our UIDs in a consistent format and data type - the same approach MongoDB Atlas functions as default if the _id UID is not provided when creating a document. |
If you're using Ultimately, this issue is about consistency across our products. All other SDKs and MongoDB/Atlas Device Sync support nullable primary keys and so should we. If that's not something you need, you are by no means forced to use it - it's completely optional. |
Right now we prevent primary keys from being nullable, but there's no reason for this. We should allow it.
The text was updated successfully, but these errors were encountered: