在MongoDB中,可以使用createCollection()
方法来创建集合。
语法:
db.createCollection(name, options)
参数说明:
name
:集合的名称。
options
:可选参数,用于指定集合的一些属性,例如索引、大小等等。
示例:
db.createCollection("myCollection")
上述示例将创建一个名为"myCollection"的集合。如果集合已经存在,则会忽略该操作。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:mongodb查询集合的方法是什么