Hi ,
I need to get a certain document and modify only one field in it .
Tried to use find and modify as fellow :
var success = playerSavesCollection.findAndModify({"playerName" : Spark.getPlayer().getUserName()},JSONData);
but it's replacing everything in this document with the new jsondata when i want to only add the jsondata if not existing or modify it if exist
Hello,
You can simply do this:
var playerSaveData = playerSavesCollection.findOne({"playerName" : Spark.getPlayer().getUserName()}); if (playerSaveData !== null) { playerSaveData.anyField = "anyValue"; var success = challengeCollection.update({"playerName" : Spark.getPlayer().getUserName()}, playerSaveData); }
ahmed mohi
Hi ,
I need to get a certain document and modify only one field in it .
Tried to use find and modify as fellow :
var success = playerSavesCollection.findAndModify({"playerName" : Spark.getPlayer().getUserName()},JSONData);
but it's replacing everything in this document with the new jsondata when i want to only add the jsondata if not existing or modify it if exist
Thanks :DHello,
You can simply do this:
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstChristian Gauthier
Hello,
You can simply do this:
ahmed mohi
-
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 2487 topics