今回は mongo クライアントを使ってみます。
Ubuntu10.04 の場合、mongodb パッケージをインストールすると mongo クライアントも入ります。
起動します。
$ mongo MongoDB shell version: 1.2.2 url: test connecting to: test type "exit" to exit type "help" for help >
出力されている通り help 表示してみます。
> help
HELP
show dbs show database names
show collections show collections in current database
show users show users in current database
show profile show most recent system.profile entries with time >= 1ms
use <db name> set curent database to <db name>
db.help() help on DB methods
db.foo.help() help on collection methods
db.foo.find() list objects in collection foo
db.foo.find( { a : 1 } ) list objects in foo where a == 1
it result of the last line evaluated; use to further iterate
なんか色々と出ました。
exit で終了します。
> exit bye $
たぶん続きます。