khanh8609vnz3
Posts: 8
Joined: Tue Jul 28, 2020 4:39 am

How to query data inside Devices Collection

Hi Appery team,

I have added one custom column to Devices collection name "userId", then I create one server code to query data of Devices collection, try to get the userId that I save in Devices collection.

When I use this code:

Code: Select all

var params = {};
params.criteria = {
  "userId": {
    "$ne": null
  }
};

var result = Collection.query(dbId, 'Devices', params);

I got this error: ApperyioAPI: Collection 'Devices' absent in database with id 'xxxxxx'.

So my question is how to query data from Devices collection, it is a Predefined collection like User

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Re: How to query data inside Devices Collection

Hello,

  1. Please use the collection name "_devices", not "Devices" here

  2. Please add the Master Key (in the last parameter of that method) to the request, this collection requires permissions to read data.

Return to “Issues”