开发者

Why is mongo not connecting to my table by command line?

开发者 https://www.devze.com 2023-03-23 19:47 出处:网络
Everything connects properly in my app, but when I try to do so by command line I can\'t seem to connect.

Everything connects properly in my app, but when I try to do so by command line I can't seem to connect.

mongod --port 27018 --dbpath ~/code/server/db/seed
Wed Jul 27 15:49:08 MongoDB starting : pid=84222 port=27018 d开发者_开发知识库bpath=/Users/jeremysmith/code/server/db/seed 64-bit 
Wed Jul 27 15:49:08 db version v1.6.5, pdfile version 4.5
Wed Jul 27 15:49:08 git version: 0eb017e9b2828155a67c5612183337b89e12e291
Wed Jul 27 15:49:08 sys info: Darwin erh2.10gen.cc 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40
Wed Jul 27 15:49:08 [initandlisten] waiting for connections on port 27018
Wed Jul 27 15:49:08 [websvr] web admin interface listening on port 28018


$ mongo 127.0.0.1:27018
MongoDB shell version: 1.6.5
connecting to: 127.0.0.1:27018/test

> use seeds_db
switched to db seeds_db

> show collections
preferences
sites
stat_definitions
system.indexes

> seeds_db.stat_definitions.find();
Thu Jul 28 12:26:34 ReferenceError: seeds_db is not defined (shell):0

> stat_definitions.find();         
Thu Jul 28 12:26:37 ReferenceError: stat_definitions is not defined (shell):0

> seeds_db['stat_definitions'].find();
Thu Jul 28 12:26:59 ReferenceError: seeds_db is not defined (shell):0


Do you just need to replace seeds_db with db? eg.

db.stat_definitions.find();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号