Skip to content
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

Option for reads to reflect uncommitted changes in the current transaction #81

Open
mattmccutchen opened this issue Feb 11, 2017 · 0 comments

Comments

@mattmccutchen
Copy link
Collaborator

For my app, I wanted reads (i.e., find and findOne) to reflect uncommitted changes in the current transaction, like in a real transactional database, without having to use instant mode and exposing those changes to other readers. This package could have an option to do that.

The basic idea would be to keep a minimongo collection of the updated, uncommitted documents and have a find implementation that queries both the uncommitted changes and the underlying data source and combines the results correctly. Implementing the basic find/findOne of an arbitrary selector wouldn't be bad, but supporting sort, skip, limit, and observe/observeChanges would get complicated. This "collection overlay" library may belong in a separate package, like minimongo itself.

In my app, the collections are small enough that I just make temporary copies of all the collections, work on the temporary collections, and at the end of the transaction, diff the temporary collections against the original collections one document at a time and issue the corresponding insert/update/remove operations (implementation). This has the side benefit that my app can use API features that Minimongo supports and this package currently doesn't (e.g., #80).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant