node-express-mongodb-jwt-rest-api-skeleton icon indicating copy to clipboard operation
node-express-mongodb-jwt-rest-api-skeleton copied to clipboard

npm run clean - "model.deleteMany is not a function"

Open rohanshukla94 opened this issue 3 years ago • 3 comments

The Issue A clear and concise description of what the bug is. When I run the npm run clean command I get the error saying 'model.deleteMany is not a function'

rohanshukla94 avatar Dec 16 '21 10:12 rohanshukla94

Your MongoDB must be too old. Try upgrading.

davellanedam avatar Dec 16 '21 18:12 davellanedam

ζ mongo --version [bbe462d] MongoDB shell version v5.0.3 Build Info: { "version": "5.0.3", "gitVersion": "657fea5a61a74d7a79df7aff8e4bcf0bc742b748", "openSSLVersion": "OpenSSL 1.1.1 11 Sep 2018", "modules": [], "allocator": "tcmalloc", "environment": { "distmod": "ubuntu1804", "distarch": "x86_64", "target_arch": "x86_64" } }

I think it maybe because you are not checking if all the models exists in the db before deleting them?

rohanshukla94 avatar Dec 16 '21 19:12 rohanshukla94

Are you trying to clean without first seed? Yeah that can also happen

davellanedam avatar Dec 16 '21 20:12 davellanedam