I am creating an admin panel with a database that has a lot of types of data within one collection.
I am using mongodb and adminbro and mongoose!
types of data under the same collectoin are vehicules with the type of (cars, buses, boats ), and I have several pages for each one of them, for example If I want to add a car I will go to the cars tab, same for the ohters.
I would like to show the cars only when I go to the "cars", right now whenever I go to the cars option I will get all the vehicules not only the car!
This is the following code that I have tried to run in the before and after hook:
const displayOnlyCars = () => {
return {
...request,
query: {
...request.query,
'filters.type': 'car'
}
}
Using AdminBro 4.0.1