Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

493
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!