2

I want to get all players in GameSparks data with an email field. I can Query in Data Explorer, but when I tried it in CloudCode it does not work.

In GameSparks documentation I found this:

var results = Spark.metaCollection('metatest').find({"metatest1" : {"$gt" : 1}});

I replaced it with this:

var results = Spark.metaCollection('player').find({"email":{"$exists":"true"}});

When I trying to get the count of 'results' it returns 0.

What am I doing wrong? Is it impossible to access the MongoDB entries for any of the System Collections defined by GameSparks (like 'player', 'challengeInstance' etc.)?

Robert Columbia
  • 6,313
  • 15
  • 32
  • 40
Tatev
  • 79
  • 1
  • 6

1 Answers1

2

You need to use systemCollection instead of metaCollection.

Robert Columbia
  • 6,313
  • 15
  • 32
  • 40
Tatev
  • 79
  • 1
  • 6