javascript - Firebase Firestore list of all IDs in a collection - Stack Overflow

Google Firebase seems to be difficult to wrap my head around... I have no problems in getting documents

Google Firebase seems to be difficult to wrap my head around... I have no problems in getting documents and their data out of a collection, but when I try to simply get a list of all the IDs inside a collection, I am not able to figure out what the call should look like. I have tried searching for the info, but without success.

I have a function declared in my service ponent, which looks like this:

getCollRegistrationNumbers(): firebase.firestore.CollectionReference {
  return firebase.firestore().collection(`storedItems`);
}

Then in e.g. the Search page of my app, I am calling the function from my ponent, but whatever I try, it returns empty.

Given the service function above, how should I plete the code below to just git a list of the IDs?

this.fireStore.getCollRegistrationNumbers().get()
  .then(snapshot => {....})

Google Firebase seems to be difficult to wrap my head around... I have no problems in getting documents and their data out of a collection, but when I try to simply get a list of all the IDs inside a collection, I am not able to figure out what the call should look like. I have tried searching for the info, but without success.

I have a function declared in my service ponent, which looks like this:

getCollRegistrationNumbers(): firebase.firestore.CollectionReference {
  return firebase.firestore().collection(`storedItems`);
}

Then in e.g. the Search page of my app, I am calling the function from my ponent, but whatever I try, it returns empty.

Given the service function above, how should I plete the code below to just git a list of the IDs?

this.fireStore.getCollRegistrationNumbers().get()
  .then(snapshot => {....})
Share edited Aug 10, 2023 at 17:43 Renaud Tarnec 83.2k10 gold badges98 silver badges129 bronze badges Recognized by Google Cloud Collective asked Nov 5, 2018 at 17:02 NorthFredNorthFred 5003 gold badges8 silver badges26 bronze badges 1
  • Can anybody tell How we can query and get this middle collection/ids so we can query next subcollection by ids ? – Ashish Gehlot Commented Jan 17, 2021 at 6:38
Add a ment  | 

1 Answer 1

Reset to default 3

Look at how your documents are displayed in an italic font: this means, in the console, that these documents are only present as "container" of one or more sub-collection but that they are not "genuine" documents.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744912701a4600647.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信