Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

246
Visualizações
best practice for nonexistent values in json object / mongodb object schema?

I am planning the schema for some objects to eventually be saved in a MongoDB collection. The objects I generate now are the output from a server app.

              "release-data": [
                {
                  "community": {
                    "have": 13,
                    "want": 8
                  },
                  "marketplace": {
                    "num_for_sale": null,
                    "lowest_price": null
                  },
                  "date": "2022-3-21 20:30:8"
                }
              ],
              "price-suggestions": [
                {
                  "prices": {},
                  "date": "2022-3-21 20:30:8"
                }
              ]

I am wondering if the best practice for the above fields which have no value would be null or empty object. Or maybe the marketplace field itself is assigned null or an empty object in this case?

I was considering a minimal approach where in this example the marketplace field in the release-data array would not exist and same thing with the prices field in the price-suggestions array not existing. But is that considered a bad practice since it is impossible to tell if the data is truly nonexistent or was omitted in error?

Is there anything else I may not be considering?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda