Can you provide some examples on how to use NoSQL part of the control panel?
It doesn't have a field where we can put raw NoSQL query and tabs for different actions are confusing and unclear what we need to put where for it to work.
I am trying to do a simple find all operation but saying db.player.find() or player.find() or just find() doesn't seem to work. What exactly are we supposed to do? Is there a specific syntax I am unaware of?
Best Answer
T
Tech Support
said
over 5 years ago
Hi Ana
In the find tab you put the arguments you would in db.player.find(). Clicking submit in the find tab actually does a db.<collection>.find() internally, and the fields allow you to control the parameters passed.
For a find all (db.player.find()) leave the query field empty
For a selective find, something like db.player.find({"userName" : "gabriel"}) put {"userName" : "gabriel"} in the query field.
In the find tab you put the arguments you would in db.player.find(). Clicking submit in the find tab actually does a db.<collection>.find() internally, and the fields allow you to control the parameters passed.
For a find all (db.player.find()) leave the query field empty
For a selective find, something like db.player.find({"userName" : "gabriel"}) put {"userName" : "gabriel"} in the query field.
The interface was inspired by MongoHub
Hope that helps!
Gabriel
A
Ana Stepic
said
over 5 years ago
Aaa, so that's how it works!
Thank you for the info.
I've never used MongoHub, I always wrote raw NoSQL so the interface was unfamiliar. Thank you for clearing that up. Now that I understand how to use it, it is quite handy to skip writing db.player.find!
J
Jorge Aldao
said
over 5 years ago
Another NoSQL question...in cloud code, how can I query a collection for a specific Id? Using "ObjectId", as specified in the MongoDB manual, isn't recognized in the cloud code.
Thank you!
Tech Support
said
over 5 years ago
You can use the mongo extended json format to achieve this
This is the same format you see for _id fields in the NoSql explorer.
Hope thats useful!
Gabriel
1 person likes this
J
Jorge Aldao
said
over 5 years ago
Great! Thank you!
A
Antonio Donoso Hurtado
said
over 5 years ago
One more NoSQL question. In cloud code, is there a way to query gamespark's collections like "player" or "challengeInstance"? Thanks.
Customer Support
said
over 5 years ago
Hi Antonio,
Unfortunately there is no direct way to access the player and challenge
instance collections from Cloud Code
There are however Cloud Code API’s for working with the current player and
challenges. There is more information about this found here in the manual but
here are the links I am referring to:
The NoSQL Explorer allows the developer to access the Player and
ChallengeInstance collections and allows the data to be exported for offline
analysis.
If you have any further questions please let us know.
Kind Regards,
Jamie
A
Antonio Donoso Hurtado
said
over 5 years ago
Ok. Thank you!
I
Inés Naiberger
said
about 2 years ago
Is there any way to use NoSQL code to directly do things like renaming a (runtime) collection?
Ana Stepic
Can you provide some examples on how to use NoSQL part of the control panel?
It doesn't have a field where we can put raw NoSQL query and tabs for different actions are confusing and unclear what we need to put where for it to work.
I am trying to do a simple find all operation but saying db.player.find() or player.find() or just find() doesn't seem to work. What exactly are we supposed to do? Is there a specific syntax I am unaware of?
Hi Ana
In the find tab you put the arguments you would in db.player.find(). Clicking submit in the find tab actually does a db.<collection>.find() internally, and the fields allow you to control the parameters passed.
For a find all (db.player.find()) leave the query field empty
For a selective find, something like db.player.find({"userName" : "gabriel"}) put {"userName" : "gabriel"} in the query field.
The interface was inspired by MongoHub
Hope that helps!
Gabriel
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
Hi Ana
In the find tab you put the arguments you would in db.player.find(). Clicking submit in the find tab actually does a db.<collection>.find() internally, and the fields allow you to control the parameters passed.
For a find all (db.player.find()) leave the query field empty
For a selective find, something like db.player.find({"userName" : "gabriel"}) put {"userName" : "gabriel"} in the query field.
The interface was inspired by MongoHub
Hope that helps!
Gabriel
Ana Stepic
Aaa, so that's how it works!
Thank you for the info.
I've never used MongoHub, I always wrote raw NoSQL so the interface was unfamiliar. Thank you for clearing that up. Now that I understand how to use it, it is quite handy to skip writing db.player.find!
Jorge Aldao
Another NoSQL question...in cloud code, how can I query a collection for a specific Id? Using "ObjectId", as specified in the MongoDB manual, isn't recognized in the cloud code.
Thank you!
Tech Support
You can use the mongo extended json format to achieve this
Spark.runtimeCollection("test").findOne({ "_id": { "$oid": "5331a09ce4b0489502a73b9c" }})
This is the same format you see for _id fields in the NoSql explorer.
Hope thats useful!
Gabriel
1 person likes this
Jorge Aldao
Great! Thank you!
Antonio Donoso Hurtado
One more NoSQL question. In cloud code, is there a way to query gamespark's collections like "player" or "challengeInstance"?
Thanks.
Customer Support
Hi Antonio,
Unfortunately there is no direct way to access the player and challenge instance collections from Cloud Code
There are however Cloud Code API’s for working with the current player and challenges. There is more information about this found here in the manual but here are the links I am referring to:
Spark Player:
https://docs.gamesparks.net/documentation/cloud-code-api/spark-cloud-code-api/sparkplayer
Spark Challenges:
https://docs.gamesparks.net/documentation/cloud-code-api/spark-cloud-code-api/sparkchallenge
Also this is how you get hold of the SparkPlayer and SparkChallenge object:
https://docs.gamesparks.net/documentation/cloud-code-api/spark-cloud-code-api/spark#getPlayer
The NoSQL Explorer allows the developer to access the Player and ChallengeInstance collections and allows the data to be exported for offline analysis.
If you have any further questions please let us know.
Kind Regards,
Jamie
Antonio Donoso Hurtado
Inés Naiberger
Is there any way to use NoSQL code to directly do things like renaming a (runtime) collection?
-
Documentation Notes
-
Design issues with user events
-
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 2476 topics