how can I do to insert idPlayer like 401 and not "idPlayer"
(same thing for NoQuestion and idGame)
Thnaks
Customer Support
said
over 7 years ago
Hey Guys,
This is standard behavior in order for the document to be parsed properly when preforming queries with mongoDB. You can receive or query these element by wrapping them in double-quotes too.
Team Savie
Hi,
I would like inserting informations into my metacollections. I would like this, but the data I receive it's not in this format
{idPlayer :
{
idGame :
{
"Questions" :
{
noQuestion :
{
"good" : true,
"time" : 1.5854,
"count" : 2
}
noQuestion :
{
"good" : false,
"time" : 2.9654,
"count" : 1
}
}
}
}
}
but when I receive the data and insert
var doc = { playerID : { idGame : {"Questions" : { noQuestion : {}}}}};....
gamesparks put quotes (") on "playerID", "idGame" and "noQuestion"
My apologies, i misunderstood.
Of course you can do that, check out the snippet below...
- Oldest First
- Popular
- Newest First
Sorted by Newest FirstTeam Savie
Thanks !
Customer Support
My apologies, i misunderstood.
Of course you can do that, check out the snippet below...
Team Savie
What do you mean ?
Here some code
var idGame = myArray["idGame"] (where myArray["idGame"] = 1788)
var playerID = responses[item]["NoMembre"] (where responses[item]["NoMembre"] = 400)
docInsert = { playerID : { idGame : {}}};
Spark.metaCollection("QuestionsMembres").insert(docInsert);
gives me :
"playerID" : {
"idGame" : {
}
}
and I would like to have :
"400" : {
"1788" : {
}
}
Thanks again
Customer Support
You can try db.collection.Insert() or db.collection.FindAndModify() if you like?
But unless you already have those in your form, you will have to use double quotes to insert them.
Sean
Team Savie
Hi,
I think you misunderstand me.
idGame, idPlayer and noQuestion are variables
I send something like this :
{"idGame" : 1788, "reponses" : {"reponse0" : {"BonneReponse" : true,"timeQuestion" : 1.586113,"NoMembre" : 400,"NoQuestion" : 11},"reponse1" : {"BonneReponse" : false,"timeQuestion" : 2.191174,"NoMembre" : 229,"NoQuestion" : 2},"reponse2" : {"BonneReponse" : true,"timeQuestion" : 1.879101,"NoMembre" : 400,"NoQuestion" : 16},"reponse3" : {"BonneReponse" : true,"timeQuestion" : 3.341267,"NoMembre" : 229,"NoQuestion" : 10},"reponse4" : {"BonneReponse" : true,"timeQuestion" : 1.837307,"NoMembre" : 400,"NoQuestion" : 6},"reponse5" : {"BonneReponse" : true,"timeQuestion" : 2.163567,"NoMembre" : 229,"NoQuestion" : 14},"reponse6" : {"BonneReponse" : true,"timeQuestion" : 2.315758,"NoMembre" : 400,"NoQuestion" : 15}}}
}
I recover idPlayer et all responses.
var myArray = Spark.getData().theArray;
var idGame = myArray["idGame"];
var responses = myArray["reponses"];
for (var item in responses)
{
var bIsInsert = false;
var docInsert;
var reponse = responses[item];
var playerID = responses[item]["NoMembre"];
var noQuestion = responses[item]["NoQuestion"];
}
how can I do to insert idPlayer like 401 and not "idPlayer"
(same thing for NoQuestion and idGame)
Thnaks
Customer Support
This is standard behavior in order for the document to be parsed properly when preforming queries with mongoDB.
You can receive or query these element by wrapping them in double-quotes too.
Sean
-
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