3. @ IPRUG
{"IPRUG": {
"tagline": "The source of all things Ruby in Suffolk",
"website": "http://www.iprug.org",
"members": [
{"name": "MrJaba", "role": "foolhardy organizer",
"presentations" : ["higher order ruby", "websockets"]},
{"name": "KerryB", "role": "foolhardy presenter"}
]
}
}
A Document
4. @ IPRUG
1. Install Daemon
Download and install the mongod - the database daemon itself
2. Install Driver
gem install mongo
gem install bson_ext (optional for extra performance)
How do you use it? Part
1.
5. @ IPRUG
How do you use it? Part
2.
1. Connect:
db = Mongo::Connection.new.db("mydb")
2. Insert a document:
coll = db.collection("RUGS")
iprug = { "IPRUG" => {"tagline" => "The source of all things Ruby
in Suffolk", "website" => "iprug.org" } }
coll.insert(iprug)
6. @ IPRUG
How do you use it? Part
3.3. Updating:
iprug["tagline"] = "Suffolk haz Ruby!"
coll.update({"_id" => iprug["_id"]}, iprug)
7. @ IPRUG
How do you use it? Part
4.4. Find all:
coll.find()
5. Conditions:
coll.find("tagline" => "Suffolk haz Ruby!")
6. Range Queries:
coll.find("value" => {"$gt" => 20, "$lte" => 30})
7. Regex queries:
coll.find( {"tagline" => /^Suffolk/} )