I know I cant query the db with find method and checks if it returns an empty array, but is there any specific method in Mongoose to check if the DB has no objects in it?
In the mongo shell you could just do:
if (db.getCollectionNames().length === 0) {
// It's empty
...
}
Each language's driver should have something equivalent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With