I'm making an update to one of the documents in my collection, which has quite a large number of fields.
I want to write an event that allows me to update only one specific field in this document.
But using the update method requires that I specify all current field values as parameters, otherwise the update removes them.
var gameData = Spark.runtimeCollection('gameData'); gameData .update({"id":id}, {"status":status});
So what happens here, is the whole document is updated, but now it only has a status field, and all other fields are removed.
How do I only update the status field? I've tried setting the 'upset' parameter on update to true as well, but this makes no difference.
use $set
var gameData = Spark.runtimeCollection('gameData'); gameData.update({"id":id}, {$set:{"status":status}});
Greg Quinn
I'm making an update to one of the documents in my collection, which has quite a large number of fields.
I want to write an event that allows me to update only one specific field in this document.
But using the update method requires that I specify all current field values as parameters, otherwise the update removes them.
So what happens here, is the whole document is updated, but now it only has a status field, and all other fields are removed.
How do I only update the status field? I've tried setting the 'upset' parameter on update to true as well, but this makes no difference.
use $set
Christian Gauthier
use $set
1 person likes this
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2486 topics