Skip to main content
edited body
Source Link
Accollativo
  • 531
  • 1
  • 5
  • 12

Edit 24/01/25: the second solution for paginating a filtering it's not the best choice, considering. Considering that a city's user don't need to query at the same time across multiple tax type, maybe separate the tax type is still a good option, but I will non split data by year. At this point maybe instead of this third solution below where I have 2 collection for tax type, I'm wondering if it's better a fourth solution where I create a collection for every couple of cityId/taxType (so collections houseTax_G273, hotelTax_G273, houseTax_H501, and so on) but this scares me, 8000 cities and 3 tax types means 24000 collection, maybe not a good idea:

Edit 24/01/25: the second solution for paginating a filtering it's not the best choice, considering that a city's user don't need to query at the same time across multiple tax type, maybe separate the tax type is still a good option, but I will non split data by year. At this point maybe instead of this third solution below where I have 2 collection for tax type, I'm wondering if it's better a fourth solution where I create a collection for every couple of cityId/taxType (so collections houseTax_G273, hotelTax_G273, houseTax_H501, and so on) but this scares me, 8000 cities and 3 tax types means 24000 collection, maybe not a good idea:

Edit 24/01/25: the second solution for paginating a filtering it's not the best choice. Considering that a city's user don't need to query at the same time across multiple tax type, maybe separate the tax type is still a good option, but I will non split data by year. At this point maybe instead of this third solution below where I have 2 collection for tax type, I'm wondering if it's better a fourth solution where I create a collection for every couple of cityId/taxType (so collections houseTax_G273, hotelTax_G273, houseTax_H501, and so on) but this scares me, 8000 cities and 3 tax types means 24000 collection, maybe not a good idea:

added 917 characters in body
Source Link
Accollativo
  • 531
  • 1
  • 5
  • 12

Edit 24/01/25: the second solution for paginating a filtering it's not the best choice, considering that a city's user don't need to query at the same time across multiple tax type, maybe separate the tax type is still a good option, but I will non split data by year. At this point maybe instead of this third solution below where I have 2 collection for tax type, I'm wondering if it's better a fourth solution where I create a collection for every couple of cityId/taxType (so collections houseTax_G273, hotelTax_G273, houseTax_H501, and so on) but this scares me, 8000 cities and 3 tax types means 24000 collection, maybe not a good idea:

{
    "cityId": "G273",
    "records": [
        {
            "name": "John Doe",
            "year": 2011,
            "paymentDate": "2011-11-11",
            "paymentId": "aqw134"
        }, {...}
    ]
}

Edit 24/01/25: the second solution for paginating a filtering it's not the best choice, considering that a city's user don't need to query at the same time across multiple tax type, maybe separate the tax type is still a good option, but I will non split data by year. At this point maybe instead of this third solution below where I have 2 collection for tax type, I'm wondering if it's better a fourth solution where I create a collection for every couple of cityId/taxType (so collections houseTax_G273, hotelTax_G273, houseTax_H501, and so on) but this scares me, 8000 cities and 3 tax types means 24000 collection, maybe not a good idea:

{
    "cityId": "G273",
    "records": [
        {
            "name": "John Doe",
            "year": 2011,
            "paymentDate": "2011-11-11",
            "paymentId": "aqw134"
        }, {...}
    ]
}
improved solution design
Source Link
Accollativo
  • 531
  • 1
  • 5
  • 12

Edit 23/01/2025: Maybe this other solution, where I create a collection for every tax type and a document for every couple of cityId/taxTypeyear will be more efficient (maybe use the year too wouldn'twould be a bad idea)better:

{
    "cityId": "G273",
    "taxType""year": "houseTax"2011,
    "records": [
        {
            "year": 2011,
            "name": "John Doe",
            "paymentDate": "2011-11-11",
            "paymentId": "aqw134"
        }, {...}
    ]
}

Edit 23/01/2025: Maybe this other solution, where I create a document for every couple of cityId/taxType will be more efficient (maybe use the year too wouldn't be a bad idea):

{
    "cityId": "G273",
    "taxType": "houseTax",
    "records": [
        {
            "year": 2011,
            "name": "John Doe",
            "paymentDate": "2011-11-11",
            "paymentId": "aqw134"
        }, {...}
    ]
}

Edit 23/01/2025: Maybe this other solution, where I create a collection for every tax type and a document for every couple of cityId/year would be better:

{
    "cityId": "G273",
    "year": 2011,
    "records": [
        {
            "name": "John Doe",
            "paymentDate": "2011-11-11",
            "paymentId": "aqw134"
        }, {...}
    ]
}
added 56 characters in body
Source Link
Accollativo
  • 531
  • 1
  • 5
  • 12
Loading
improved solution design
Source Link
Accollativo
  • 531
  • 1
  • 5
  • 12
Loading
Source Link
Accollativo
  • 531
  • 1
  • 5
  • 12
Loading