0

I would like to count the result of the query and I´m using the API Parse. The code:

 string appId = ConfigurationManager.AppSettings["ParseApplicationID"].ToString();

 string dotNetId = ConfigurationManager.AppSettings["ParseNetID"].ToString();

 ParseClient.Initialize(appId, dotNetId);

 var query = ParseObject.GetQuery("Installation").WhereEqualTo("deviceType", "ios");
 var count = await query.CountAsync();

but the count is 0 and there is a lot of ios devices.

Is there any problem with my code?

enter image description here

1 Answer 1

1

The Installation class is a special class, and as a string it is prefixed by an underscore, but there's a property for getting a query for it.

var query = ParseInstallation.Query;

You may not be able to do this without the master key, if you have public Find permissions turned off for the class (which you should.)

Sign up to request clarification or add additional context in comments.

5 Comments

Fosco, I changed the class name to "_Installation" and I get the error "Use the class-specific query properties for class _Installation Param name: className", any idea?
ParseInstallation.GetQuery() require the classname argument. With the code: var query = ParseInstallation.GetQuery("_Installation").WhereEqualTo("deviceType", "ios"); get the same error ("Use the class-specific query..."). Could you see the image of Data Browser is the question edition? On mouse over of first Installation class I can see "_Installation" but I can´t get the count...
Sorry Fosco, int count = ParseInstallation.Query.WhereEqualTo("deviceType", "ios").CountAsync(); throw the error Cannot directly query the Installation class. Thanks
I was afraid of that, it's a good security feature.... move this logic to a cloud function, and call the function from the client.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.