Validate docs agains custom values before adding to (or updating) collection #2436
Closed
islamaliev
started this conversation in
Feature request
Replies: 1 comment
-
Since an issue was created for this, I'll close the discussion to keep the reference only in one place. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is the request related to a problem?
No response
The feature you would like
I would be nice to have a way of imposing some constrains on certain doc values for all docs in a collection.
For example, if we want to restrict user's age to be min 18, or we want to allow only a set of values like languages ["EN", "DE", "FR"] (line enum).
It should work similar to MongoDB's schema validation.
Another nice-to-have would be to add simple arithmetic and dynamic value. This would allow us to set, for example, restriction on a date (like meeting time) to be after current time.
Another nice-to-have to allow cross-referencing constrains that check one value agains another one.
Alternatives considered
No response
Additional context
Another thing to keep in mind is how this will work with p2p and to resolve conflicts. For example, if a doc field is set to be not greater then 10 and 2 users in the network increment the current value 0 by say 7. Locally everything will be valid, but when synching it will be set to 14.
Beta Was this translation helpful? Give feedback.
All reactions