Limiting database collection by user

For my marketplace I want to offer sellers different packages where they can place a maximum number of listings with each package.

Is it possible to set a limit in my database and how do I do that?

Hi @Essie ,

You can use count for this, but you need to link the listing collection to users collection first.

For extra safety, you can even add numbers field that is increased whenever seller add more listings and decrease it when it deactivate that listing.

The beauty of relationship database is we get extra functions such as count, sum, max, min to provide validation.

1 Like

Hi Yonki,

Thnx for your help. Iā€™m not sure I get you right. Can you please help me out with a screenshot?

Hi @Essie ,

You can read here,

So whenever limit has been reached, visibility kicks in.