mongodb 使ってみる
epal の 2.4を入れました。
簡単に mongo.configを作成して
bind_ip = 127.0.0.1
port = 31230
fork = true
pidfilepath = /home/????/data/mongodb/mongodb.pid
logpath = /home/????/log/mongodb/mongodb.log
dbpath=/home/????/data/mongodb/data
journal = true
nohttpinterface = true
$ mongo –port 31230
MongoDB shell version: 2.4.12
connecting to: 127.0.0.1:31230/test
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
>
薄い本のコマンドを適当に全部入れていくとだいたいわかりました。
複数index, 全文検索は別途確認が必要そう。
> use learn
switched to db learn
> db.getCollectionNames()
[ ]
> db.unicorns.update({name:"Horny"},{$set:{name:"jo"}})
> db.unicorns.ensureIndex({name:1},{unique:true})
> db.unicorns.getIndexes()
[
{
"v" : 1,
"name" : "_id_",
"key" : {
"_id" : 1
},
"ns" : "learn.unicorns"
},
{
"v" : 1,
"name" : "name_1",
"key" : {
"name" : 1
},
"unique" : true,
"ns" : "learn.unicorns"
}
]
> db.unicorns.update({name:"Horny"},{$set:{name:"jo"}})
E11000 duplicate key error index: learn.unicorns.$name_1 dup key: { : "jo" }
>
- Prev DNSサーバーを立てる。BIND.
- Next mongodbとphp
- Next mongodbとphp