I have data structured according to Firebase's flat structure advice, storing quotes in nodes like this:
quotes -> clientName -> quoteObject
Each 'quoteObject' includes a 'dateCreated' value that I aim to retrieve as follows (when fetching a comprehensive list of quotes for a specific page and consolidating them into a single array of objects):
const quotesRef = firebase.database().ref('quotes');
quotesRef.orderByChild('dateCreated').on('value', snapshot => {
// function
});
The issue arises when attempting to query the 'dateCreated' value located more than one level deep. While deep path queries are feasible with parent path knowledge, my situation involves uniquely named parent paths ('clientName'). Is there a way to specify a wildcard path in this case? If so, how can it be achieved? Thank you!
Edit: Including database example for clarification.
quotes
- ClientEmailOne
-UniqueQuoteID
- createdBy: ClientEmailOne
- dateCreated: 1479255005172
- email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="06656a6f63687275436b667877732e9c9890">[email protected]</a>"
- ClientEmailTwo
-UniqueQuoteID
- createdBy: ClientEmailTwo
- dateCreated: 1479255005172
- email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9bf8f7f2fef5efe8defafbefbeb1fbfafbcffffbefbf4fbfaaffefafbfcfffbbabfeffaeb4effdffd29dfbe69df3">[email protected]</a>"
- ClientEmailThree
-UniqueQuoteID
- createdBy: ClientEmailThree
- dateCreated: 1479255005172
- email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7b1817121e150f083ee9eceae4edcffeecaaede2fbedeaeadce4e2eaffeded8eecf18cef7">[email protected]</a>"
-UniqueQuoteID
- createdBy: ClientEmailThree
- dateCreated: 1479255005172
- email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c4a7a8ada1aab0b781acbdc9bdbdd2bdabb7afa8afc4adaf">[email protected]</a>"
-UniqueQuoteID
- createdBy: ClientEmailThree
- dateCreated: 1479255005172
- email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9efdf2f7fbf0eaeddbf9fdfbffffdaccdcbcfaca7cdcfdedadccfccafdadecebcfbdadecd20f7ecfedcffbad7d0">[email protected]</a>"