Sign In Register

How can we help you today?

Start a new topic
Solved

Game data Service queryItems method return service unavailable

Hello everyone,


Right now I am trying to migrate some persistent data code from old mongoldb collections to the new game data service.


I've created a new datatype and I am able to insert data using cloud code.

I can even query data inserted using data explorer but when I am trying do query data using cloud code I am receiving the  and error message.


here the cloud code:


var GDS = Spark.getGameDataService();


var condition = GDS.S("user").eq(userName);

var sort = GDS.sort("letter",true);


var query = GDS.queryItems("LETTERSTATS", condition, sort);


the error message received

  • {
      "@class": ".GameSparksErrorResponse",
      "error": {
        "message": "Query service unavailable (event/AppUser_LetterStats_Get.js#45)"
      },
      "message": "Query service unavailable (event/AppUser_LetterStats_Get.js#45)"
    }

I found myself what was causing the error.

Game data service "condition" and "sort" parameters are case sensitive (You have to type the exactly short code  you've created at datatype index management page).


Hi William,


Glad to hear you got this resolved. If you need anything else just let us know


Regards,

Liam

I was facing this very same issue but noticed it happens when you also don't have entries in the given collection. Just an advice for future adventurers.

@Support, I suppose queryItems should never throw an error because returned object contains error property which should contains error description... Also error descriptions in some cases are misleading, for example when I have typo in indexed key short code or when I use wrong type for number (N) instead string (S) query.


3 people like this
Login to post a comment