Sign In Register

How can we help you today?

Start a new topic
Answered

Accessing player collection in cloud code


 The following code returns an empty array in Cloud Code but returns 2 values in the NoSQL explorer. Is the collection "player" not available to query in Cloud Code? I just want to read from it.

Spark.runtimeCollection("player").find({ "_id": { "$in" : [{"$oid":"57eda800e62c9073b92356df"}, {"$oid":"57fd5abce879cb9abad35696"}] } }, {'displayName': 1} );

  

Someone asked this, but didn't get a direct answer

https://support.gamesparks.net/support/discussions/topics/1000054737


Best Answer

Hi Christopher,


In that case we would recommend adding them to the custom collection and then indexing the required fields. If you need any help getting this set up just let us know.


Thanks,

Liam


Hi Christopher,


What exactly are you looking to do here ? Accessing any system collections in this manner generally isn't encouraged as they should be kept for system use. We have a Tips & Tricks guide on how to mirror certain user details to a custom runtime collection so you can query them when required. You can find it here. If you can go into detail about your requirements I'm sure we can point you in the right direction here.


Thanks,

Liam

I need to get a list of userNames from playerIds. I only expect to do read operations when querying the player system collection.

Answer

Hi Christopher,


In that case we would recommend adding them to the custom collection and then indexing the required fields. If you need any help getting this set up just let us know.


Thanks,

Liam

Login to post a comment