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 }}
This repository has been archived by the owner on Sep 30, 2023. It is now read-only.
The problem with this is, if you restart the process, it'll retrieve the latest stored entry for each (existing) entry. Also you can't get the most recently updated entry this way when an existing document is updated. You'd have to keep an updated_at entry so you can query the highest value.
Alternatively you can use the replicate.progress event and read entry.payload.value, but when the process restarts, the data is fired newest to oldest, while oldest to newest would also be a common use case, e.g. for building a separate state or database.
The readme describes
db.events.on('data', (dbname, event) => ... )
as a way to listen for new data entries/updates, but this event does not exist.Currently, it looks like you'd have to do this to get the latest entry:
The problem with this is, if you restart the process, it'll retrieve the latest stored entry for each (existing) entry. Also you can't get the most recently updated entry this way when an existing document is updated. You'd have to keep an
updated_at
entry so you can query the highest value.Alternatively you can use the
replicate.progress
event and readentry.payload.value
, but when the process restarts, the data is firednewest to oldest
, whileoldest to newest
would also be a common use case, e.g. for building a separate state or database.Having the
on('data', dbname, event)
event as described in the readme would be much more efficient.The text was updated successfully, but these errors were encountered: