Hi all,
is it possible to use const attributes - which are declared in a seperate module - in CloudCode to do searches with NoSQL?
See the following example:
CloudCode Module [SOME_MODULE]
const SOME_ATTR = "some_attr"; const SOME_ATTR2 = "some_attr_2";
CloudCode Event [SOME_EVENT]
require("SOME_MODULE"); Spark.runtimeCollection(SOME_ATTR).find({SOME_ATTR2 : Spark.getPlayer().getPlayerId()});
The use of SOME_ATTR works great but within the find-method I get zero results (if I use hard coded string instead it works).
Do you have any advice?
Hi Artem,
If you do something like this it should work:
require("SOME_MODULE");
var query = {};
query[SOME_ATTR2] = Spark.getPlayer().getPlayerId();
Spark.runtimeCollection(SOME_ATTR).find(query);
Kind regards,
Jonathan.
Artem Hofmann
Hi all,
is it possible to use const attributes - which are declared in a seperate module - in CloudCode to do searches with NoSQL?
See the following example:
CloudCode Module [SOME_MODULE]
CloudCode Event [SOME_EVENT]
The use of SOME_ATTR works great but within the find-method I get zero results (if I use hard coded string instead it works).
Do you have any advice?
Hi Artem,
If you do something like this it should work:
require("SOME_MODULE");
var query = {};
query[SOME_ATTR2] = Spark.getPlayer().getPlayerId();
Spark.runtimeCollection(SOME_ATTR).find(query);
Kind regards,
Jonathan.
Tech Support
Hi Artem,
If you do something like this it should work:
require("SOME_MODULE");
var query = {};
query[SOME_ATTR2] = Spark.getPlayer().getPlayerId();
Spark.runtimeCollection(SOME_ATTR).find(query);
Kind regards,
Jonathan.
-
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