Is it possible to get only documents name as a String array without retrieving any collections? I couldn't find any documentation about it.
Asked
Active
Viewed 2,298 times
1 Answers
2
There is no API to retrieve only the document names in the SDKs. But the REST API has a list
call that seems to do precisely that.

Frank van Puffelen
- 565,676
- 79
- 828
- 807
-
In near future, will there be an API in order to retrieve only the document names in the SDKs? @FrankvanPuffelen – Orcun Sevsay Jan 28 '18 at 17:26
-
Am I overlooking a parameter that causes `list` to return only document names? It looks like the default response is an [array of documents](https://firebase.google.com/docs/firestore/reference/rest/v1beta1/projects.databases.documents/list#response-body). – Bob Snyder Jan 28 '18 at 18:48
-
You're not overlooking anything Bob, I had simply assumed that `list` returned only the IDs. :-/ While it does have a `mask` parameter which allows you to control what fields it returns (if any), I think it will still need to read all documents to determine if they contain those fields. :-/ – Frank van Puffelen Jan 29 '18 at 02:56
-
@MiloRambaldi I doubt that is considered crucial before the product goes GA. Note that your question is very much a [XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). There may be a great way to implement the use-case you're looking for, without having a way to list document IDs. – Frank van Puffelen Jan 29 '18 at 02:58
-
1@FrankvanPuffelen Thanks for your response. As you said I find another way to implement the use-case I'm looking for. But I believe it would be a nice feature if it's done in future. – Orcun Sevsay Jan 29 '18 at 06:58