文档帮助中心文档
下降MongoDB集合
的dropCollection函数将在未来的版本中被删除。使用dropCollectionMongoDB的功能®而不是c++接口。
dropCollection
dropCollection(康涅狄格州、收集)
例子
dropCollection (康涅狄格州,集合)通过使用MongoDB连接从MongoDB删除一个现有的集合。
dropCollection (康涅狄格州,集合)
康涅狄格州
集合
全部折叠
连接MongoDB并删除一个集合。
创建到数据库的MongoDB连接mongotest.这里是数据库服务器dbtb01使用端口号托管该数据库27017.
mongotest
dbtb01
27017
服务器=“dbtb01”;端口= 27017;dbname =“mongotest”;康涅狄格州= mongo(服务器、端口dbname)
conn = mongo with properties: Database: 'mongotest' UserName: " Server: {'dbtb01'} Port: 27017 CollectionNames: {' airlinesal ', 'employee', 'largedata'…and 3 more} TotalDocuments: 23485919
康涅狄格州是蒙戈包含MongoDB连接的对象。对象属性包含有关连接和数据库的信息。
蒙戈
数据库名称为mongotest.
用户名为空。
数据库服务器为dbtb01.
端口号为27017.
这个数据库包含六个文档集合。前三个集合名是airlinesmall,员工,largedata.
airlinesmall
员工
largedata
这个数据库包含23,485,919个文档。
检查MongoDB连接。
isopen(康涅狄格州)
逻辑1
数据库连接成功,因为isopen函数返回1.否则,数据库连接将关闭。
isopen
1
属性删除集合之前,在数据库中显示集合CollectionNames财产。
CollectionNames
conn.CollectionNames
ans = 1×7 cell array列1到5 {' airlinsmall '} {'employee'} {'largedata'} {'nyctaxi'} {'product'}列6到7 {'restaurants'} {'taxidata'}
使用MongoDB连接从数据库中删除一个现有的集合。指定集合名称taxidata.
taxidata
收集=“taxidata”;dropCollection(康涅狄格州、收集)
属性在数据库中再次显示集合CollectionNames财产。数据库不再包含集合taxidata.
ans = 1×7 cell array列1到5 {' airlinsmall '} {'employee'} {'largedata'} {'nyctaxi'} {'product'}列6 {'restaurants'}
关闭MongoDB连接。
关上(康涅狄格州)
MongoDB连接,指定为蒙戈对象。
集合名称,指定为字符串标量。
例子:“taxidata”
“taxidata”
数据类型:字符串
字符串
蒙戈|关闭|isopen|createCollection|找到
关闭
createCollection
找到
你点击一个链接对应于这个MATLAB命令:
通过在MATLAB命令窗口中输入命令来运行命令。Web浏览器不支持MATLAB命令。金宝app
选择一个网站,在那里获得翻译的内容,并看到当地的活动和优惠。根据您的位置,我们建议您选择:.
你也可以从以下列表中选择一个网站:
选择中国网站(中文或英文)以获得最佳网站性能。其他MathWorks国家站点没有针对您所在位置的访问进行优化。
与当地办事处联系