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
The return_changes optarg (for mutation commands) should return the changes in order #5041
In the current implementation, the changes don't come back in the same order as the documents inserted (the order isn't specified). That makes the always mode essentially useless.
The changes in this case should be guaranteed to come back in order.
/cc @mlucy (we just discussed this) and @Tryneus (he needs this for a secret super-project he's working on)
The reason I was asking is because insert is somewhat different from the other write operations.
In the case of insert, the order is explicitly specified in the command itself, as you pass an array with documents.
For an update, replace or delete, the order is not provided in the same way. Instead it's implicit in the selection that the command is applied on. We could return changes in the "right" order if the selection is ordered, such as in r.table('test').orderBy({index: "id"}).delete(). Unless this is something that will occur in Fusion, I think that's a pretty rare use case though.
I suspect that we'll also need separate code to ensure this for insert vs. the other write terms.
I suggest that we implement it for insert first. Does that sound reasonable?
I think we only actually need it for insert since that's the only place where we don't have an id for a failed document operation and have to rely on stuff like ordering to figure out what went wrong
Activity
danielmewes commentedon Nov 5, 2015
Would this be only for
insert?deontologician commentedon Nov 5, 2015
Also, it would be nice if there were error changes inserted if the documents fail to insert properly, rather than fake keys like generated_keys
coffeemug commentedon Nov 5, 2015
I was going to add -- including errors would be really helpful.
I think this should be the case for all commands where you can pass
{ returnChanges: 'always' }, not justinsert.danielmewes commentedon Nov 30, 2015
The reason I was asking is because
insertis somewhat different from the other write operations.In the case of
insert, the order is explicitly specified in the command itself, as you pass an array with documents.For an
update,replaceordelete, the order is not provided in the same way. Instead it's implicit in the selection that the command is applied on. We could return changes in the "right" order if the selection is ordered, such as inr.table('test').orderBy({index: "id"}).delete(). Unless this is something that will occur in Fusion, I think that's a pretty rare use case though.I suspect that we'll also need separate code to ensure this for
insertvs. the other write terms.I suggest that we implement it for
insertfirst. Does that sound reasonable?danielmewes commentedon Nov 30, 2015
Also +1 on that
errorsyntax.deontologician commentedon Dec 2, 2015
I think we only actually need it for insert since that's the only place where we don't have an id for a failed document operation and have to rely on stuff like ordering to figure out what went wrong
neumino commentedon Dec 2, 2015
It's the same as #3853 -- and would be really nice as thinky now has to do it itself (and that it's annoying when primary keys are not string).
danielmewes commentedon Dec 3, 2015
Ah thanks @neumino . I had a feeling you had brought this up before for Thinky, but I couldn't find the issue when I looked for it.
karlgrz commentedon Jan 20, 2016
This is slightly annoying for us, as well. Any date on 2.3 release candidates?
danielmewes commentedon Jan 20, 2016
@karlgrz Our current estimate for 2.3 is 1-2 months from now.
karlgrz commentedon Jan 20, 2016
@danielmewes thank you!
nighelles commentedon Jan 29, 2016
This is in review 3452.
Implemented in nighelles/5041
https://github.com/rethinkdb/rethinkdb/tree/nighelles/5041
nighelles commentedon Feb 16, 2016
This is in next.
karlgrz commentedon Feb 16, 2016
Fantastic news, thank you!