healthtree / firestore-join Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Is your feature request related to a problem? Please describe.
Firestore stores dates as their own timestamp type. To use dates on our application and with third party libraries we need to convert them to JS dates.
We have a transform function that checks for timestamps at the first level of data and if the value has the .toDate
function defined, we call it and store that value instead.
The problem is that now we are storing dates on nested properties, either on objects or arrays of objects. Our transform function is not picking this cases.
Describe the solution you'd like
Modify the transform function:
Line 170 in 333d16c
Refactor the code so we can recursively transform the data inside serializedDocument
.
Is your feature request related to a problem? Please describe.
When we use firebase join to include reference relations, we do this on an inefficient way.
Example:
We get all the news for the homepage, and for each new piece we include the categories.
This means that if we get 50 news, we hit the db to get the categories. Even tho we only have 10 categories.
Same thing happens on the category's articles page, we hit the db to get same category N (number of articles) times.
This problem will repeat across the app because most of the relations we have are belongs to
.
Describe the solution you'd like
Create a cache layer that we can manage from the application to set cached collections.
I imagine a function exported from 'firestore-join' with this signature:
setCachedCollection('apps/community/articleCategories', serializedDocumentArray);
serializedDocumentArray
could come from a snapshot listener, or from a simple .get() that was serialized.
Then I would store a map for the cache with {'collectionName1': array1, 'collectionName2: array2, ... }
if we wanted to clear the cache we could just do:
setCachedCollection('apps/community/articleCategories',[]);
Then from inside firestore-join
we need to modify the parts of the code that usedocumentReference.get()
(line 99 and 111) a reference to check on the cache first based on the documentReference.collection
and documentReference.path
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.