Having this structure for example:
Businesses (collection)
business1 (doc)
business2
business3
info (object)
location:
earnings:
products: (object or collection?)
product1
product2
product3 (object)
name:yy
price:xx
likes:3
I am creating a businesses
collection, where every document is a business
, and inside abusiness
doc I will have 2 objects - info
and products
.
I will need to be able to:
- Read a
business
including everything (all products) based on business or product name - Add a new product to a business
If i use a sub-collection
called products
for every business, i will not be able to read in one shot the info
and the products
(all data for a specific business name).
If i use an array of objects called products
(inside a business
doc), I will not be able to query for a business
doc, based on a product
name
.
Is this even possible to achieve ?