I have data in which I've tried to follow Firebase's advice about flat structure so I'm not pulling more than I need. The net result is I have quotes organised in nodes like this:
quotes -> clientName -> quoteObject
the quoteObjects have a 'dateCreated' value, and I want to be able to pull this data like so (for when I'm pulling one big list of all the quotes for a specific page, I then use object assign to make one big array of objects to display) :
const quotesRef = firebase.database().ref('quotes');
quotesRef.orderByChild('dateCreated').on('value', snapshot => {
// function
});
Unfortunately the dateCreated value is more than one level deep so the standard query doesn't work. I know you can do a deep path query if you know the parent path, but in my case the clientName parent is always unique. Given this, is it possible to specify a kind of wildcard path? If so how would I go about that? Cheers!
Edit: Showing database example, sorry should have been more specific initially.
quotes
- ClientEmailOne
-UniqueQuoteID
- createdBy: ClientEmailOne
- dateCreated: 1479255005172
- email: "clientsEmail@example.com"
- ClientEmailTwo
-UniqueQuoteID
- createdBy: ClientEmailTwo
- dateCreated: 1479255005172
- email: "clientsEmail@example.com"
- ClientEmailThree
-UniqueQuoteID
- createdBy: ClientEmailThree
- dateCreated: 1479255005172
- email: "clientsEmail@example.com"
-UniqueQuoteID
- createdBy: ClientEmailThree
- dateCreated: 1479255005172
- email: "clientsEmail@example.com"
-UniqueQuoteID
- createdBy: ClientEmailThree
- dateCreated: 1479255005172
- email: "clientsEmail@example.com"