-
Notifications
You must be signed in to change notification settings - Fork 16
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
Rethink namespacing of tx options #86
Comments
What would happen in that case is the transactions package would only look at fields in the `tx` value, ignoring the rest of the top level fields in the main object passed, then it would remove the tx field before passing the object with all the rest of the fields to collection2 (say) or the native mutator methods to do their thing. So (if the package supported it) {upsert: true} would still work.
|
That would make sense, but it doesn't seem to be what the code does. It sets |
You're quite right. The original options don't get passed on to the mutator methods. That's an omission on my part - consequence of not using TDD and trying to write code to accommodate cases that my own apps don't use.
In answer to: "But are name collisions enough of a risk to justify keeping this feature at all?"
You're probably right that it's unnecessary. I guess my original motivation was that, with the pot-pourri of fields that could be used by mongo (e.g. upsert), the package (e.g. description, instant, overridePermissionCheck, etc.), and a whole host from collection2, the namespace might get a little cluttered.
I'm doubtful that anyone is using that particular feature and I'm happy to remove it with a note about a breaking change in the CHANGELOG.md. (Since it doesn't work as intended anyway.)
|
The readme says:
What are the relevant scenarios here? If we add support for the standard
multi
(#80) andupsert
(#84) options, it seems natural to me to pass them at the top level even if atx
object is used. In particular, a call tocollection.upsert(sel, mod, {tx: {...}})
will get automatically turned intocollection.update(sel, mod, {upsert: true, tx: {...}})
, and it would be confusing if that didn't do an upsert.The text was updated successfully, but these errors were encountered: