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

494
Visualizações
Collection object is not callable. If you meant to call the createCollection method on a Database object it is failing because no such method exists

I am having issues with mongoDB specifically when trying to create a collection.

I have imported pymongo and DNS they both work but when I try to create a collection using db.createCollection("verified"), it would throw an error saying that 'Database' not an attribute of 'createCollection'

Here is the part of my code that involves MongoDB:

import pymongo
import dns

client = pymongo.MongoClient(myMongoDBconnectionURL)
db = client['MainDB']
db.createCollection("verified")

Do you know what is causing this?

Thanks

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

0

I suspect that you are using the wrong MongoDB Documentation (as in, the documentation of a MongoDB implementation in a different programming language). createCollection is not a method of pymongo.database.Database, but create_collection is:

import pymongo
import dns

client = pymongo.MongoClient(myMongoDBconnectionURL)
db = client['MainDB']
db.create_collection("verified")
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