My collection structure :
[
{
_id: id,
createdAt: date,
name: string,
subObject: {
id: {
name: string,
type: string,
coordinates: [ [] ], // big
},
id: {
name: string,
…
}
},
{
_id: id,
…
When I update my collection that way :
Collection.update( {
_id: targetID,
}, {
$set: {
[ `subObjects.${ id }.type` ]: type,
},
} );
Meteor send the complete updated object trough the socket.
Why not… except that subObject
is a large collection of coordinates arrays. So the socket send me 1 to 5 mo each time I make an update depending of the target. This is not usable.
Is there a way to ask for atomic updates answers ?
in the socket, the request message is :
["{\"msg\":\"method\",\"method\":\"/collection/update\",\"params\":[{\"_id\":\"dJGDKXuJtWDrgDZgn\"},{\"$set\":{\"subObjects.xxx.type\":\"type_name\"}},{}],\"id\":\"3\"}"]
And the answer :
{"msg":"changed","collection":"geometries","id":"dJGDKXuJtWDrgDZgn","fields":{"subObjects":[{"XXX… and soooo much more
When I update a first level key in my collection object it returns only that key. Why not when I update a second level ?
I tried to make subObject
an array instead of an object. Does not fix.