Answer the question
In order to leave comments, you need to log in
How to check if collection is empty MongoDB?
How to check if a collection in a database is empty? I use MongoDB
I tried to do it by type:
db = db.collection.find()
if db is None:
print("Пусто")
else:
print("Что-то")
Answer the question
In order to leave comments, you need to log in
db.collection.count()
https://docs.mongodb.com/manual/reference/method/d...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question