2014-05-02 37 views

回答

0

一種方法是查詢命名空間集合,像這樣:

> 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