Home > Net >  How can I get data count in react, firebase
How can I get data count in react, firebase

Time:05-11

There are mutiple data with multiple key such as:

collection('temp')

cateId name

100001 : sdfasdfasd

100001 : dfdgfsdg

100001 : sdfasdsdd

100002 : sdfa

100002 : sdsdd

100002 : dfasdsdd

100002 : fasdsdd

I want to get result like below.

100001 (3)

100002 (4)

import { dbService } from "fbase";

dbService.collection('temp'). // I can't complet T.T;

CodePudding user response:

You can use the JavaScript Map operator to map the index to each document.

.docs().map((doc,index) => {
   <here you can manipulate
    as you see fit>
  })
  • Related