question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documents in journal and realtime collection have different _id

See original GitHub issue

My understanding is that _id gets assigned to the document when an insert gets executed by the mongodb client. The fact that the write to realtime collection is happening asynchronously makes me think that it is possible that some ids may end up being out of order between the batches. Besides, _id is used as an offset on the query side and when eventsByTag is used the saved offset (retrieved from the realtime collection) won’t in fact exist in the journal which at least makes it weird as the ordering of ids may still make sense. I think setting _id field explicitly when serializing events makes sense as id generation is happening on the client side anyway so we get the same uniqueness and sequencing guarantees but it ensures the same documents in the two collections have the same ids.

Also wanted to point out how the write to the realtime collection is happening asynchronously with no error handling:

batchFuture.andThen { case _ => doBatchAppend(writes, realtime) }

I think at least some error logging would be useful, but it could also be a good idea if the user of the library could choose if an error to write to realtime collection should be propagated. I think failing all realtime subscriptions can be useful. Then the stream can restart and pick up missed events from the journal and continue listening to realtime events

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
scullxbonescommented, Mar 4, 2019

Fixed by #222 … will update with a release version

1reaction
scullxbonescommented, Feb 20, 2019

Ah ok yep I get it now, thanks for summarizing. Now I totally understand why the _id is a problem, I was struggling a bit with that. This just further convinces me that #214 / #95 are needed to fix in the ideal way. The _id fix would be good for consistency, and would help in the meantime for sure.

Bullet 2 will probably be a stretch, so i’d think 1 & 3 should take priority. I’m good with this ticket covering both. I’ll pull bullet 2 into a separate ticket.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase Firestore storing data in Realtime Frestore for same ...
There is no way to have multiple documents directly inside another document. But it is possible to have a subcollection under a document, ......
Read more >
Collection need to have ids from 2 other different ... - MongoDB
I am creating my first project using MongoDB. Where there is a need of having two foreign keys in a collection if I...
Read more >
CDI Tips and Tricks - Ex Libris Knowledge Center
The DB ID is case-sensitive. Finding a CDI Record for a Grouped Collection in Primo. Although all our databases appear as separate collections ......
Read more >
Cloud Firestore Data model - Firebase
The names of documents within a collection are unique. You can provide your own keys, such as user IDs, or you can let...
Read more >
Journal Articles - ORCID
Collecting iDs for all your authors and reviewers during the publication process — whether for books, journals, datasets, compositions, presentations, code, or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found