Reorganize data with pattern while migrating from SQL to MongoDB
I have several tables in Oracle, in each of them are stored data about a different kind of tax declaration (house tax, hotel tax, and so on). All of them have some data in common, so I want to migrate data to MongoDB and build an application to show them. The data will be accessed by 2 mandatory fields, the user first select a city id, and then in the next page select the type of tax. Others fields can be used as optional filters. I was thinking to use only one collection for all the tax types, is a good choice or is better to let them be separated as they are in the Oracle DB? The biggest city can have roughly 30000 records for tax type and grow max by 9000 for year. If we consider all the cities of the nation, the biggest tax type have 500000 records. I gave a look to the bucket pattern because I want to paginate 10 records for page, I though to paginate the data by paymentDate, but the data can be rearranged and filtered by optional fields too, so maybe it's not a good idea, but if 30000 records are too much, maybe I can create buckets by year. What do you think about? My final idea was only to use attribute pattern, do you suggest any improvements? { "taxList": [{"houseTax": "tax for property house"}, {"hotelTax": "tax for hotel and b&b"}], "taxListSize": 2, "cities": [{"idCity": "G273", "houseTax": [{ "name": "John Doe", "paymentDate": "11/11/2011", "year": 2011, "paymentId": "aqw134"}, { "name": "Banana Joe", "paymentDate": "01/21/2012", "year": 2012, "paymentId": "aqr5w134"}], "hotelTax": [{ "name": "Jack Daniels", "paymentDate": "14/12/2011", "year": 2011, "paymentId": "44aqw134"}]}, {"idCity": "H501", "houseTax": [{ "name": "John Connor", "paymentDate": "11/01/2021", "year": 2021, "paymentId": "aq66w134"}], "hotelTax": [{ "name": "Sarah Connor", "paymentDate": "14/02/2019", "year": 2019, "paymentId": "4yy4aqw134"}]}] }
I have several tables in Oracle, in each of them are stored data about a different kind of tax declaration (house tax, hotel tax, and so on). All of them have some data in common, so I want to migrate data to MongoDB and build an application to show them.
The data will be accessed by 2 mandatory fields, the user first select a city id, and then in the next page select the type of tax. Others fields can be used as optional filters.
I was thinking to use only one collection for all the tax types, is a good choice or is better to let them be separated as they are in the Oracle DB? The biggest city can have roughly 30000 records for tax type and grow max by 9000 for year. If we consider all the cities of the nation, the biggest tax type have 500000 records.
I gave a look to the bucket pattern because I want to paginate 10 records for page, I though to paginate the data by paymentDate
, but the data can be rearranged and filtered by optional fields too, so maybe it's not a good idea, but if 30000 records are too much, maybe I can create buckets by year
. What do you think about?
My final idea was only to use attribute pattern, do you suggest any improvements?
{
"taxList": [{"houseTax": "tax for property house"},
{"hotelTax": "tax for hotel and b&b"}],
"taxListSize": 2,
"cities": [{"idCity": "G273",
"houseTax": [{ "name": "John Doe",
"paymentDate": "11/11/2011",
"year": 2011,
"paymentId": "aqw134"},
{ "name": "Banana Joe",
"paymentDate": "01/21/2012",
"year": 2012,
"paymentId": "aqr5w134"}],
"hotelTax": [{ "name": "Jack Daniels",
"paymentDate": "14/12/2011",
"year": 2011,
"paymentId": "44aqw134"}]},
{"idCity": "H501",
"houseTax": [{ "name": "John Connor",
"paymentDate": "11/01/2021",
"year": 2021,
"paymentId": "aq66w134"}],
"hotelTax": [{ "name": "Sarah Connor",
"paymentDate": "14/02/2019",
"year": 2019,
"paymentId": "4yy4aqw134"}]}]
}
What's Your Reaction?