Comments (8)
The adminRefs
and userRefs
are for reading the user documents under the users
collection.
from saas.
Makes sense. Thanks!
from saas.
Sorry I am gonna ask another noob question,
What if we don’t use the adminRefs
and userRefs
and instead fetch from the database using id only? I am just curious how adminRefs
and userRefs
are benefiting us?
from saas.
No worries.
There are two approaches to not use adminRefs
and userRefs
.
-
After reading the user IDs from
access
oradmins
array, loop through theusers
collection one by one based on the list of IDs. I think this is definitely not a very efficient way to retrieve data because each ID will need an API call to theusers
collection to retrieve the user document. -
After reading the user IDs from
access
oradmins
array, execute a query to retrieve all the user documents from theusers
collection that match the IDs in the array. However, I can't find examples to query a collection based on a list of IDs in the document https://firebase.google.com/docs/firestore/query-data/queries, so I designed the system to use array of reference to resolve it. This is possible based on googleapis/nodejs-firestore#990, but I am not sure about the performance compared to the current method.
Cheers,
from saas.
Thanks man! I just have this one doubt,
The cloud function getAccountUsers
includes:
let getUsers = [];
accountRef.data().accessRefs.forEach(user => {
getUsers.push(getDoc('users/'+user.id));
});
return Promise.all(getUsers);
Aren’t you executing getDoc
for each user? Wouldn’t each user then will require an API call in this case?
from saas.
True, looks like it's OK to remove adminRefs
and accessRefs
and simply to use admins
and access
to simplify the data structure. Thanks for the question.
from saas.
This issue is resolved in commit dd1286c
from saas.
Thanks!
from saas.
Related Issues (20)
- How do you determine if a user has a subscription? HOT 2
- mailgun configuration HOT 2
- Billing period on invoice doesn't show monthly term length HOT 20
- Getting CORS error from cloudfunction HOT 2
- Anyone using an M1 Mac to build/deploy? HOT 3
- core-js@<3.3 is no longer maintained and not recommended for usage HOT 1
- How to setup trial subscription products HOT 1
- coreui error HOT 3
- Issue with deployment HOT 7
- No window.coreui object in browser when run locally HOT 5
- Free payment Stripe issue HOT 1
- 404 not found when refreshing page HOT 1
- Theming HOT 1
- Cypress E2E tests HOT 1
- cannot run the code locally HOT 3
- Stuck HOT 11
- Initialization error
- createSubscription error HOT 7
- Permissions object missing from config.json HOT 1
- I get this when 'npm i @fireactjs/saas-cloud-functions' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from saas.