stop mongodb creating dbs and collections dynamically

前端 未结 3 1787
南方客
南方客 2021-01-11 10:58

Is there a way to switch off the ability of mongo to sporadically create dbs and collections as soon as it sees one in a query. I run queries on the mongo console all the ti

3条回答
  •  时光说笑
    2021-01-11 11:20

    For people who are using Mongoose, a new database will get created automatically if your Mongoose Schema contains any form of index. This is because Mongo needs to create a database before it can insert said index.

提交回复
热议问题