Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

492
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda