-
Notifications
You must be signed in to change notification settings - Fork 863
Cloud Firestore Connector #1660
Comments
Here's a collection of considerations to know about when making this connector. Most of this is fact, some of this opinion, and I think the two are discernable in this comment. Take my opinions with a grain of salt. I highly recommend reading the Firestore documentation to learn more about the product, but I've highlighted some important topics. Types
Structure DataThe Firestore documentation goes into detail regarding the pros and cons of different data structures. I think this entire section is worth a read. My thought on this is to model everything, including relationships, as a root-level collection; however, the con to that is:
I think the nature of GraphQL and this connector will help abstract away that concern. DenormalizationAnother concern is denormalizing data for performance and cost purposes. An advanced data model may want to aggregate data on the edge of a relationship (i.e. A like count). Firestore does not support aggregate queries, so it would be awesome if this binding managed the complexity of aggregating data in a denormalized way. Query DataA few quirks to note:
Indexes
Given this, it's probably important to either expose an index directive on the data model, implicitly add indexes based on fields and types in the data model, or index all the things queryable by Prisma. The indexes should be output in an {
"indexes": [
{
// The name of the collection
"collectionId": "restaurants",
// The location of the indexed field, and the sort order
"fields": [
{ "fieldPath": "city", "mode": "ASCENDING" },
{ "fieldPath": "avgRating", "mode": "DESCENDING" }
]
},
]
} Optimizations
A additional thoughts
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions. |
Something that worth noting is that Firebase now supports Authenticating with limited privileges (i.e. as a client/user) by calling initializeApp with admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://databaseName.firebaseio.com",
databaseAuthVariableOverride: {
uid: "some-user-id"
}
}); This should be helpful when trying to query as a client since we can pass along their UID. |
For feature requests, please fill in the next sections:
What feature are you missing?
A Cloud Firestore connector (from Google Firebase)
How could this feature look like in detail? Tradeoffs?
I guess much the same way as other NoSQL connectors that are being planned
The text was updated successfully, but these errors were encountered: