[SERVER-24430] Allow default values to be set for new documents Created: 07/Jun/16 Updated: 07/Feb/23 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Styvane Soukossi | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 9 |
| Labels: | validation | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Execution
|
| Participants: | |
| Case: | (copied to CRM) |
| Description |
| Comments |
| Comment by Katya Kamenieva [ 05/Apr/21 ] | ||||||||||||||||||||||||
|
This request is not currently scheduled and remains in the backlog. To all the interested users, please feel free to add comments with details of your use case for this feature. | ||||||||||||||||||||||||
| Comment by Deepak SP [ 02/Apr/21 ] | ||||||||||||||||||||||||
|
Is anyone working on this issue? | ||||||||||||||||||||||||
| Comment by Kelsey Schubert [ 08/Jun/16 ] | ||||||||||||||||||||||||
|
Hi styvane, Thanks for confirming! I've marked this ticket to be considered during the next round of planning. Please continue to watch for updates. Kind regards, | ||||||||||||||||||||||||
| Comment by Styvane Soukossi [ 07/Jun/16 ] | ||||||||||||||||||||||||
|
Hi anonymous.user, Yes, this exactly the behavior I would like to see implemented. Thank you | ||||||||||||||||||||||||
| Comment by Kelsey Schubert [ 07/Jun/16 ] | ||||||||||||||||||||||||
|
Hi styvane, I'd like to make sure I'm understanding this feature request. Please review my theoretical example below with made up syntax below. While this feature will most likely utilize a different syntax if it is implemented, I would first like to make sure we are the same page.
Is this the behavior you would like to see implemented? If not, would you please clarify your request with additional examples? Thank you, | ||||||||||||||||||||||||
| Comment by Styvane Soukossi [ 07/Jun/16 ] | ||||||||||||||||||||||||
|
What I want for example is assign a "default" to "c" if the "c" field is not present in the document being inserted. | ||||||||||||||||||||||||
| Comment by Daniel Pasette (Inactive) [ 07/Jun/16 ] | ||||||||||||||||||||||||
|
What document are you trying to validate? Include your update or insert operator that is failing. Also, it is not clear what you are trying to accomplish in your $or clause, because you are checking that "c" is a string or if the value of "c" is equal to the string "default" | ||||||||||||||||||||||||
| Comment by Styvane Soukossi [ 07/Jun/16 ] | ||||||||||||||||||||||||
|
I got the `$or` syntax wrong here, as it should be:
Anyway that does solve the problem. We still have validation error if we insert something like this:
It yields:
This is because in our validation rule {'c': "default"}means "c" equals "default". |