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" }
>

This entry was posted on 金曜日, 12月 26th, 2014 at 6:32 PM and is filed under mongodb. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Unityによるゲームを公開しております iOS/Android
https://itunes.apple.com/jp/app/lost-knight-3d-action/id900917032
https://play.google.com/store/apps/details?id=com.groundroad.runknight

各種開発支援・機能開発等小さいお仕事などもお請けしております。
unity開発支援, PHPシステム開発, javascript/html5 フロント開発, titanium mobileアプリ開発
お気軽にお問い合わせください
大崎・五反田近郊での対面でのお打ち合わせはいつでも可能です。