question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

find blueprint : total count of records

See original GitHub issue

Hello,

When I do a find request with the blueprint like :

/v1/videos?limit=200

I don’t have the count of records in the response while it is said in the doc :

First of all, it optimises select data from database based on required fields and populates only associations, that you really need to populate. It mixins metadata in the root of a response also, so you know total count of records, criteria, current page, etc…

The response :

{
    "code": "OK",
    "message": "Operation is successfully executed",
    "data": [
        {
            "id": "56c7a0aeb0ac4c060c0fde32"
        },
        {
            "id": "56c7a0c7b0ac4c060c0fde33"
        },
    ],
    "criteria": {},
    "limit": 200,
    "start": 0,
    "end": 200,
    "page": 0
}

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
IncoCodecommented, Apr 9, 2016

@prisonier you can always override the count blueprint and add your custom logic. just copy code of this function https://github.com/ghaiklor/generator-sails-rest-api/blob/dev/generators/hook/templates/api/hooks/CountHook.js#L11 into a separate file called count.js (in blueprints folder) and improve the code by adding parseCriteria etc like here: https://github.com/ghaiklor/generator-sails-rest-api/blob/dev/generators/blueprint/templates/api/blueprints/find.js#L22

0reactions
Fr33maancommented, Apr 9, 2016

@ghaiklor Thanks for your answer. With the old feature I could find the number of record for any request. It is sad that we are facing a downgrade. I guess it has been removed for performance issues ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Finding out datatable row count? - Unreal Engine Forums
I am trying to add a percentage to the progress bar divided by the amount of rows in a data table and I...
Read more >
Sails.JS - Get the count of the number of objects/rows in the ...
I explained it in this answer: Get total count in Sails JS blueprint API. You can also pass query to the count function...
Read more >
IDBObjectStore.count() - Web APIs - MDN Web Docs
The count() method of the IDBObjectStore interface returns an IDBRequest object, and, ... it returns the total number of records in the store....
Read more >
How to Find a Copy of the Original Blueprints for a House?
The best way to find blueprints is through the local public official's office. Most jurisdictions have an assessor's office or public records office....
Read more >
How count number of records? - Tableau Community
Tableau automatically creates a 'number of records' measure (which if you look at it's calculation is just the number '1'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found