2015-10-18 50 views
0

任何想法为什么collection未显示在结果中?我给自己定lastmanstanding作为当前db使用mongodb成功导入后未显示新集合

[host repo]\> mongoimport --db $OPENSHIFT_APP_NAME --collection players --drop --host $OPENSHIFT_MONGODB_DB_HOST --port $OPENSHIFT_MONGODB_DB_PORT --username $OPENSHIFT_MONGODB_DB_USERNAME --password $OPENSHIFT_MONGODB_DB_PASSWORD --file db/primer-dataset-players.json --jsonArray 
connected to: 127.2.202.130:27017 
Sun Oct 18 11:15:19.789 dropping: MyDatabaseName.players 
Sun Oct 18 11:15:19.796 imported 3 objects 
[lastmanstanding-bobbyrne01.rhcloud.com repo]\> mongo 
MongoDB shell version: 2.4.9 
connecting to: 127.2.202.130:27017/admin 
Welcome to the MongoDB shell. 
For interactive help, type "help". 
For more comprehensive documentation, see 
    http://docs.mongodb.org/ 
Questions? Try the support group 
    http://groups.google.com/group/mongodb-user 
> set MyDatabaseName 
set MyDatabaseName to true 
> show collections 
system.indexes 
system.users 

内容db/primer-dataset-players.json ..

[ 
    { 
     "name": "bobbyrne01", 
     "id": 21 
    }, 
    { 
     "name": "Someone", 
     "id": 55 
    } 
] 
+5

你可能想'使用,而不是'设置MyDatabaseName' – JohnnyHK

+0

@JohnnyHK奏效,谢谢MyDatabaseName'。 – bobbyrne01

回答

0

的命令来设置当前数据库是useset。有关文档,请参阅here

所以它应该是:的

> use MyDatabaseName 

代替

> set MyDatabaseName