How the document will be?

coffeeBean_collection
name, brand, roast profile and price
The brew options are, type of coffee beans, grinding settings
from 1 (coarse) to 7 (fine), litres of water (i.e. 0.5, 1.1, 2.2 litres),
and grams of coffee

Hi @Mohammed_Mokhtar ,

Not sure what do you specifically mean? Do you need a schema design to hold this information?

What are the queries you will perform and what is the purpose of the data.

Based on the provided information it could be a document like the following (but maybe completely different considering the needed use case):

{
name : ... ,
brand: ... ,
roastProfile :  {  ... } ,
price :   ... ,
brewOptions :  { 
    beansType : ... ,
    grindingSettings : ... ,
    water : { amount :  ... , unit : "liters"  }  ,
    grams: ...
    }
}

Thanks
Pavel

}

Hi @Pavel_Duchovny
The queries will be CRUD. it will be nice if you can help me with schema design also.
Thanks a lot
Mohammed

@Pavel_Duchovny Should the roastProfile be an object?
Not like this

{
name : … ,
brand: … ,
roastProfile : … ,
price : … ,
brewOptions : {
beansType : … ,
grindingSettings : … ,
water : { amount : … , unit : “liters” } ,
grams: …
}
}

Hi @Mohammed_Mokhtar ,

CRUD is a super generic description. To help you with specific schema consideration you should provide more specific access patterns…

Like would you seek for a specific coffee Bean machine or brand and what would the application pages or consumer search for a wider range of documents to present?

What and how often be updated , tracked etc…

The roastProfile can be anything you need : object, array of objects, just a string … Depending on type of information and its relationship, quantity with a coffee bean document…

Thanks
Pavel

Hi @Pavel_Duchovny,

It will be for variety of coffee available. Each document will be for different brand available in the market.

Thanks
Mohammed

Hi @Mohammed_Mokhtar ,

So I would start by a document for an item with all of the data for that item embeeded in the document like I mentioned…

Thanks

It will not updated that much

1 Like

Thanks @Pavel_Duchovny
Can you help with schema

@Mohammed_Mokhtar ,

With the minimal information you provided it sounds like a document per coffee product like I presented is a way
To start:

{
_id : ... ,
name : ... ,
brand: ... ,
roastProfile :  {  ... } ,
price :   ... ,
brewOptions :  { 
    beansType : ... ,
    grindingSettings : ... ,
    water : { amount :  ... , unit : "liters"  }  ,
    grams: ...
    }
}

Now if any of the values needs to be a list of limited amount of values (under 500 per doc) yiu can consider storing them in an array…

I assume you will search based on a brand or name of product and perhaps sort by price , therefore I would index :
{ name : 1, price :1} and {brand :1 , price : 1}

Fior further guidance I would suggest to do one of our online courses for schema design and read:

You can also listen to a podcast I done recently

Thanks

Thanks a lot @Pavel_Duchovny

1 Like