-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Enforce "Uniqueness" of fields #176
Comments
Investigation notes for the mongoose adapter:
|
Some notes: async list creation
unique indexes in mongoose
validation
|
Work is underway in the |
Ah, glad someone's on top of this 👌🏼 Keystone 4 handled this stuff quite badly. Indexes were created in the background and we listened to the Various comments... Backgrounding Index creation can easily take minutes or longer; I agree it should be async and run in the background by default. For simple deployments (eg. to Heroku or similar), adding indexes like this will degrade performance; Also, this is only relevant to Mongoose, yes? For relational DBs this stuff will be handled by the (yet to be defined) migration framework (#299) which is a whole other problem. @JedWatson I'm a bit confused by your comment..
I don't think this works. These errors during the indexing operation so, assuming indexing is in the background by default, connect may have succeeded minutes earlier. Am I misunderstanding? Vestigial Indexes Since there's not really any schema management with Mongo, databases tend to accumulate indexes. Eg. an It's just something to be aware of. On previous projects we occasionally just dropped all indexes and let Mongoose Full-text indexes At this level, full-text index creation isn't fundamentally different. We should handle them the same as other indexes. Other Options In addition to
This is something that needs to be explicitly allowed. Without partial index support the above example will prevent more than one Also, for adapters/DBs that support them, conditional indexes are great. They can, for example, be especially handy for simple, DB-based queues. "Make Unique"
This is handy and certainly related to unique indexes but want to see this handled separately. I'm strongly in favour of Implementing this functionality as different field type (or something) rather than tacking it into the indexing config of a Validation
We touch on this in #244. It'd be awesome to get some clarity around the validation return format; we're going to want to expose this to the hooks. Eg. a custom pre-save hook should be able to do it's own funky validation then return errors that hook into the validation presentation logic in the admin UI. |
It appears to have been renamed to |
From reading https://github.com/keystonejs/keystone-5/issues/433 , this is completed. |
eg;
Which enforces only one
User
per email address.The text was updated successfully, but these errors were encountered: