-
Notifications
You must be signed in to change notification settings - Fork 116
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
multiple snapshots: how to do getFromSnapshot
using version
#24
Comments
getFromSnapshot simply returns a snapshot and depending on the version describing that snapshot you can handle it... for example you can convert it... i.e. https://github.com/adrai/node-cqrs-domain/blob/master/lib/definitions/aggregate.js#L652 |
Hi @adrai, Instead of creating a new issue, I prefer to ask my question here. I'm using redis store, and it seems that the snapshots are all scanned by default (using Looking at the code of redis storage, I thought passing But once the snapshot is loaded, it is filtered because its revision (usually above So I feel like, if I want the latest snapshot, I need to pass the the "real" revision, but by doing this, all of the snapshots will be loaded, hence causing some "n+1 selects" issue with no need. Correct me if I'm wrong. Thanks for your awesome work. I would love to help. |
By the way, we can also reverse the question by asking: how is it possible to get the snapshot of revision |
Finally made a pull request to improve the way snapshots are loaded. |
Sorry, had no time to take a look at it... |
Browsing through the docs and this looks great.
One thing that caught my eye, is that I want to create a new snapshot after N events have happened. This results in M snapshots over time that I want to be versioned.
createSnapshot
allows me to define an optionalversion
. Normally I'd like to retrieve the latest snapshot (is there a shortcut to get to the latest without defining aversion
? ) but sometimes I want to fetch an arbitraryversion
. However,getFromSnapshot
(at least from the docs) doesn't seem to allow to passversion
How to do this?
The text was updated successfully, but these errors were encountered: