Client rawCollection()


#1

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


#2

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.


#4

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:


#5

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.


#6

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