Piyush Bansal
Piyush Bansal

Reputation: 1723

How can I get total records count from Google Datastore using Gstore-Node?

I am using gstore-node package for querying data from Google Datastore.

I did not find anywhere how to get the total record count of the query using gstore-node.

Please help me out if anyone knows.

Thanks in advance.

Upvotes: 1

Views: 794

Answers (1)

Jim Morrison
Jim Morrison

Reputation: 2887

There isn't a server side COUNT function in Cloud Datastore. So to get the count of results that match a query you'll need to run the query (in keys only mode is better) and count the results yourself after iterating through all the results.

Or you can follow the suggestion from Alfred in https://groups.google.com/forum/#!topic/gcd-discuss/XAssG40Fcz0/discussion and do a query like SELECT * FROM News LIMIT 0 OFFSET and look at the skipped_results value.

Upvotes: 1

Related Questions