Hi Christopher,
I'll have the documentation team review this and get it updated if required.
Regards,
Liam
Hi Liam,
I think I was using the update() command wrong. I wasn't using the $set operator, so the entire document was getting overwritten (with null MapId)
Christopher Stewart
According to this:
https://docs.gamesparks.com/api-documentation/cloud-code-api/cloud-data/sparkmongocollectionreadwrite.html#update
update() has two parameters and acts like mongoDB update() but passes in upsert=false.
I am getting new documents when using this function.
As an example:
var query = {
mapId: mapData[i].mapId,
id: mapData[i].id,
updatedTs: new Date(mapData[i].updatedTs)
};
Spark.runtimeCollection('kmHexGroup').update(query, {dirty: false});
Is returning the error:
This is because I somehow got an (nearly) empty object in the DB: