0

i my case,

i m using myDatabase.collections.opportunities.$.subscribe( that must save any historical step/changes for each. where there differences between documentData and previousDocumentData on "UPDATE" and "INSERT"

But im also using replicateRxCollection as it :

.then(() => replicateRxCollection< OpportunityDetail, Checkpoint<OpportunityDetail> | undefined >({ collection: myDatabase.collections.opportunities, replicationIdentifier: replication-of-opportunities, retryTime: 10 * 1000, deletedField: "_deleted", push: { batchSize: 5, handler: getPushHandler<OpportunityDetail>( "opportunities", "id", pushDocuments ), }, pull: { batchSize: 100, handler: getPullHandler<OpportunityDetail>( pullDocuments, "opportunities", "id", "updatedAt" ), }, }) )

the fact is when the initial replication start (meaning user connexion and nothing inside collection before it, and rxdb insert data by using "INSERT"), the myDatabase.collections.opportunities.$.subscribe( compare previousDocumentData as [] to documentData as [something] and create an historical step.

So how to handle that to dont set a new historical step each user connexion

i tried

  • to add _replicated:boolean to all schemas, but it sucks as solution
  • to compare updatedAt from 5mins ago, but it means we arr getting a time lack
  • i try only accept myDatabase.collections.opportunities.$.subscribe(async (changeEvent) => {if (changeEvent.operation === "UPDATE"){} : but it means no historical for creation and its limiting my app on other things

0

Browse other questions tagged or ask your own question.