You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JS driver - ignore undefined fields in MakeObject #2233
It is sometimes convenient to just set a key to undefined instead of using delete (like when copying a foreign key).
I feel like it's safe to ignore fields that are undefined.
Marking as a ReQL proposal since it's a user-visible change.
I think doing this would be better than what we have now, though I wonder how it will interact with whatever we're going to do for non-existence (might this confuse people when we change something?)
Do you think this behavior might confuse people when they call update? In my example above a reasonable expectation is that foo will be removed from the object. It seems a little weird to me, what do you think?
Activity
coffeemug commentedon Apr 9, 2014
Marking as a ReQL proposal since it's a user-visible change.
I think doing this would be better than what we have now, though I wonder how it will interact with whatever we're going to do for non-existence (might this confuse people when we change something?)
srh commentedon Apr 9, 2014
I don't see how this would be possible or make sense anywhere but the Javascript driver. (Edit: Oh, you said that.)
neumino commentedon Jul 8, 2014
Any objection if I do that?
We'll still catch
undefinedin an array, but just ignoreundefinedfields.coffeemug commentedon Jul 8, 2014
@neumino -- to clarify, do you just want to treat fields set to
undefinedas if they weren't there at all? So, for example:Is that the behavior you want?
neumino commentedon Jul 8, 2014
{foo: undefined, bar: 1}is basically the same as{bar: 1}So instead of calling
delete obj.foo, people can just doobj.foo = undefined.coffeemug commentedon Jul 9, 2014
Do you think this behavior might confuse people when they call
update? In my example above a reasonable expectation is thatfoowill be removed from the object. It seems a little weird to me, what do you think?