nativescript-plugin-firebase icon indicating copy to clipboard operation
nativescript-plugin-firebase copied to clipboard

how to get count for a query

Open mesuttalebi opened this issue 4 years ago • 0 comments

How can I get count for a query? or check if a collection is empty?

as mentioned in this doc, there is a size property in QuerySnapShot but it is undefined when trying to use.

https://firebase.google.com/docs/reference/js/firebase.firestore.QuerySnapshot#size and

https://firebase.google.com/docs/reference/js/firebase.firestore.QuerySnapshot#size

  • Why I need this, or the use case that I want to use this properties.

-- I need empty property to seed a collection, in first run. -- I also need size property to check the number of objects in a query result. for example, after a search I want to show number of total results, or I need to show number of unread notifications that user has.

are some properties and methods not exist in plugin? because I cannot found empty and size in source code also.

mesuttalebi avatar May 16 '21 17:05 mesuttalebi