Administrative units using Nestjs

26 Views Asked by At

I am newbie. I have been assigned to build an API that returns information about administrative units using Nestjs. I am currently undecided whether I should use MongoDB to store and retrieve data, or simply place the existing JSON file in the project directory and read it to generate data. If I choose to store on MongoDB, how should I structure it using @Schema()? Can you please suggest some ideas to help me?

{
    "level1_id": "01",
    "name": "Thành phố Hà Nội",
    "type": "Thành phố Trung ương",
    "level2s": [
        {
            "level2_id": "001",
            "name": "Quận Ba Đình",
            "type": "Quận",
            "level3s": [
                {
                    "level3_id": "00001",
                    "name": "Phường Phúc Xá",
                    "type": "Phường"
                },
                {
                    "level3_id": "00004",
                    "name": "Phường Trúc Bạch",
                    "type": "Phường"
                },
        }
     ]
}
0

There are 0 best solutions below