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

Removing a field value #180

Closed
mingard opened this Issue Jan 25, 2017 · 1 comment

Comments

Projects
4 participants
@mingard
Copy link
Member

mingard commented Jan 25, 2017

Current

Once set, it is not possible to remove a Reference field (see #179), or other fields for that matter.

Setting to null is the only way, however this breaks features including Reference, blocking the composure of any other Referenced documents within the current request. It also means that in order to check the existence and count of a Reference field values you must:

  • Check if it is undefined
  • Check if it is not null
  • Check that it is an array
  • Check that it has a length >= 1

Ideally, a field that is PUT/POSTed with the value null should be $unset

@mingard

This comment has been minimized.

Copy link
Member Author

mingard commented Feb 8, 2017

@jimlambie further to our discussion around whether this can be possible outside of MongoDB my suggestion is that we build into the individual db processors a field unset method, that in the case of MongoDB would look for null fields and apply them to an $unset array, but with with other database drivers handling this, if possible, with their own methods.

This would be documented and become part of the required structure of a database driver module.

@jimlambie jimlambie added this to Backlog in API Version 2 Feb 14, 2017

@jimlambie jimlambie removed this from Backlog in API Version 2 May 31, 2017

@jimlambie jimlambie added this to Backlog in API Version 3.0 May 31, 2017

@jimlambie jimlambie modified the milestone: 3.0.0 May 31, 2017

@eduardoboucas eduardoboucas moved this from Backlog to In Progress in API Version 3.0 Jul 13, 2017

@jimlambie jimlambie moved this from In Progress to Backlog in API Version 3.0 Sep 24, 2017

@jimlambie jimlambie moved this from Backlog to In Progress in API Version 3.0 Sep 24, 2017

@jimlambie jimlambie moved this from In Progress to Ready for Release in API Version 3.0 Sep 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment