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

644
Visualizações
MongoDB Compass does not allow ObjectId() while populating DB with "Insert Document" feature?

I am using MongoDB Compass version 1.25.0.

I was trying to insert a document shared by one of my colleague using the "Insert Document" feature of the MongoDB Compass.

But, it's showing that the document is not in correct format. enter image description here

I think it is validating JSON format and ObjectId() is not a valid JSON value.

I am aware that Compass would create ObjectId() automatically but I want to pass it explicitly.

I resorted to the Shell and I was able to insert the document.

My question is does MongoDB Compass allow entering ObjectId() from the UI? If yes, what am I doing wrong?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I was able to insert a document with ObjectId using below syntax:

{
    "_id": {
        "$oid": "60261ccf416a1ed478d7357a"
    }
}

I found that the documentation of a bit off in clarifying how the $oid is supposed to be used. At least for someone beginner like me.

enter image description here

over 4 years ago · Santiago Trujillo Relatório
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