0
我搜索的返回我布爾值,如果集合是函數存在如何檢查是否在MongoDB中收集?
像這樣
value bool = database.**function**(string nameColeection)
請告訴我,如果這個功能存在,是什麼名字?
我搜索的返回我布爾值,如果集合是函數存在如何檢查是否在MongoDB中收集?
像這樣
value bool = database.**function**(string nameColeection)
請告訴我,如果這個功能存在,是什麼名字?
一種方法是查詢命名空間集合,像這樣:
> db.system.namespaces.find()
{ "name" : "test.system.indexes" }
{ "name" : "test.another_test_collection" }
{ "name" : "test.another_test_collection.$_id_" }
{ "name" : "test.another_test_collection.$a_1_b_1_c_1" }
> db.system.namespaces.findOne({name: "mycollection"})
null
> db.system.namespaces.findOne({name: "test.another_test_collection"})
{ "name" : "test.another_test_collection" }
注意,這份名單還包括索引。目前沒有具體功能可以做到這一點:https://jira.mongodb.org/browse/SERVER-1938
database.CollectionExists(nameColeection); – user3577947