Client rawCollection()

Hello!
How possible use rawCollection() on client-side? Or combine server-side rawCollection() and client bulk collection?
Some examples if u can…
TY!

You cannot use rawCollection on the client. However, you can call a server-side method to return data which you can put into a client-side minimongo collection, or you can publish from a rawCollection which you can subscribe to on the client.

I’m happy to provide some examples if you can let me know what you’re trying to do.

1 Like

Using next code:
var bulk = Data.rawCollection().initializeUnorderedBulkOp();
bulk.find({id:doc.id}).update({$set:{‘count’:10}});
bulk.execute(() => {});

I tried use this code on server and client for Latency Compensation. But it is impossible for me :slight_smile:

Ah, well, that may be where this stops. Some DB operations are either impossible to predict (like aggregations), which is essentially what we want for latency compensation, or are unreasonable to predict (like bulk operations).

In these cases it may be sufficient to just accept eventual consistency - when the server does its thing and the changed data makes its way to the client (pub/sub), then the client data will be consistent with the server.

Only you will be able to make the call on how acceptable that is for your your application.

Thank you, I understand you!
it’s a pity, but u help me anyway!

1 Like