Skip to content
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

Query > Pagination: The preference overallCount was not effective #46

Closed
heapwalker opened this issue Aug 8, 2016 · 3 comments
Closed
Assignees

Comments

@heapwalker
Copy link

heapwalker commented Aug 8, 2016

According to the docs https://docs.skygear.io/js/guide/query#pagination-ordering, under the sub-section Counting the records,

To get the number of records matching a query, set the overallCount of the Query to true.

However, by real experiment, there was nothing at the second arguments of the success callback, e.g.:

query.overallCount = true;
skygear.publicDB.query(query).then(function(records, overallCount) {
    console.log('overallCount: ', overallCount);
});

it yields:

overallCount: undefined

@ben181231
Copy link
Contributor

ben181231 commented Aug 9, 2016

I think the example in the documentation does not match our implementation. The expected usage would be:

query.overallCount = true;
skygear.publicDB.query(query).then((notes) => {
  console.log('%d records matching query.', notes.overallCount);
}, (error) => {
  console.error(error);
});

@heapwalker
Copy link
Author

Great. We can get the overallCount correctly.

Would you keep current implementation and modify the docs?

@ben181231
Copy link
Contributor

@cpryanpang I would update the documentation.

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