Skip to content

count = 1 is not work in installations #1726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
ssk7833 opened this issue May 9, 2016 · 3 comments
Closed
3 tasks done

count = 1 is not work in installations #1726

ssk7833 opened this issue May 9, 2016 · 3 comments

Comments

@ssk7833
Copy link
Contributor

ssk7833 commented May 9, 2016

Environment Setup

  • Server:
    • parse-server: 2.2.7
    • operating system: Windows 7
    • local
  • Database: mongoDB 3.2.4 local

Steps to reproduce

$ curl -X GET \ 
  -H "X-Parse-Application-Id: myAppId" \
  -H "X-Parse-Master-Key: myMasterKey" \
  http://localhost:1337/parse/installations/?count=1

This is what I got:

{
  "results": [
    ...my installations...
  ]
}

But what I expected is like current Parse REST API when I use the command below:

$ curl -X GET \
  -H "X-Parse-Application-Id: myAppId" \
  -H "X-Parse-Master-Key: myMasterKey" \
  -H "X-Parse-REST-API-Key: myRestApiKey" \
  https://api.parse.com/1/installations/?count=1

It response with installations count like this:

{
  "results": [
    ...my installations...
  ],
  count: 5
}

Is this a bug?

@sdf611097
Copy link
Contributor

This issue seems have been solved by #1642.
2.2.7 req.body may get {}, option is {}.

I found that query.count() in jsSDK at 2.2.7 is work.
It can work due to the url is different(close below shows).

curl -X GET \
-H "X-Parse-Application-Id: myAppId"
-H "X-Parse-Master-Key: myMasterKey"
http://localhost:1337/parse/classes/_Installations/?count=1&limit=0

below test is failed at 2.2.7 but pass in latest commit

      var options = {
        url: config.serverURL+"/installations/?count=1&limit=0",
        headers: {
            'X-Parse-Application-Id': config.applicationId,
            'X-Parse-Master-Key': config.masterKey
        }
      }
      request(options, function (error, response, body) {
        if (!error && response.statusCode == 200) {
          var temp  = JSON.parse(body);
          expect(temp.count).toEqual(1);
        }else{
          console.log('err',error);
        }
      })

@drew-gross
Copy link
Contributor

Closing as it seems like we have a solution ready for the next version of Parse Server

@ssk7833
Copy link
Contributor Author

ssk7833 commented May 10, 2016

It works after updating to 2.2.8. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants