I am confused about the way I need to structure my documents to effectively search/fetch items by tag when needed.
Meaning, the structure of each document goes like:
{
name: "Delicious blackforest cake",
tags: ["blackforest","birthday","designer"]
...
}
{
name: "Red velvet cake",
tags: ["party","anniversary","designer"]
...
}
...
There's a total of 32 tags, and I want to fetch the cakes based on tags. This is my present structure which I feel would be inefficient while fetching.
And I want to search based on tags and name of the cake, for example
If I search de
, the search suggestions should be:
- designer cake
/* This is based on a tag */
- Delicious blackForest cake
/* This is based on an actual name */
As per my knowledge, I guess this is difficult to achieve in Firebase. Should I opt for MongoDB or should I change the structure of the document?
I want a suggestion to effectively search and fetch according to my above-stated needs.