Google Firestore - how to get document by multiple ids in one round trip?

前端 未结 11 2098
余生分开走
余生分开走 2020-11-21 22:49

I am wondering if it\'s possible to get multiple documents by list of ids in one round trip (network call) to the Firestore.

11条回答
  •  生来不讨喜
    2020-11-21 23:30

    Surely the best way to do this is by implementing the actual query of Firestore in a Cloud Function? There would then only be a single round trip call from the client to Firebase, which seems to be what you're asking for.

    You really want to be keeping all of your data access logic like this server side anyway.

    Internally there will likely be the same number of calls to Firebase itself, but they would all be across Google's super-fast interconnects, rather than the external network, and combined with the pipelining which Frank van Puffelen has explained, you should get excellent performance from this approach.

提交回复
热议问题