How to count the numbers of your database (display on site)

Hi,
The code should look like this (modify it to match your needs):

import wixData from 'wix-data';

// ...

wixData.query("myCollection")
  .eq("status", "active")
  .count()
  .then( (num) => {
    let numberOfItems = num;
  } )
  .catch( (error) => {
    let errorMsg = error.message;
    let code = error.code;
  } );

for more information - https://www.wix.com/code/reference/wix-data.WixDataQuery.html#count

Good luck :slight_smile: