Bar Camp Auckland - Mongo DB Presentation BCA4
-
Upload
john-ballinger -
Category
Technology
-
view
1.690 -
download
1
description
Transcript of Bar Camp Auckland - Mongo DB Presentation BCA4
SELECT wages FROM companies WHERE coders = “sucker”
NO, NO SQL
Wednesday, 21 July 2010
Noise
Wednesday, 21 July 2010
Lots of pretty pictures to fool you.
Wednesday, 21 July 2010
It is a rich document store.
Its Not Relational - Get Over It.
schemas for mongo : http://www.kurl.ws/wJ
Its a change
Wednesday, 21 July 2010
schemas for mongo : http://www.kurl.ws/wJ
• Document-oriented storage » JSON-style documents with dynamic schemas offer simplicity and power.• Full Index Support » Index on any attribute, just like you're used to.• Replication & High Availability »Mirror across LANs and WANs for scale and peace of mind.• Auto-Sharding » Scale horizontally without compromising functionality.• Querying » Rich, document-based queries.• Fast In-Place Updates »Atomic modifiers for contention-free performance.• Map/Reduce » Flexible aggregation and data processing.• GridFS » Store files of any size without complicating your stack.• Commercial Support »Commercial support, training, and consulting available.
MongoDB bridges the gap between key-value stores (which are fast and highly scalable) and traditional RDBMS systems (which provide rich queries and deep functionality).
MongoDB (from "humongous") is a scalable, high-performance, open source, document-oriented database. Written in C++, MongoDB features:
What
Wednesday, 21 July 2010
more info: www.mongodb.org
mongodb.org Supported• C• C++• Java• Javascript• Perl• PHP• Python• Ruby
Community Supported• REST• C# and .NET• Clojure• ColdFusion• Delphi• Erlang• Factor• Fantom• F#• Go• Groovy• Haskell• Javascript
• Lua• node.js• Objective C• PHP• PowerShell• Python• Ruby• Scala• Scheme (PLT)• Smalltalk
Supported Drivers
Wednesday, 21 July 2010
Install on ubuntu
All Instructions http://kurl.ws/wH
EDIT YOUR SOURCES FILEnano /etc/apt/sources.list
ADD THE FOLLOWING LINEdeb http://downloads.mongodb.org/distros/ubuntu 9.4 10gen
NOW UPDATE APTapt-get update
apt-get install mongodb-stable
apt-get install php5-dev
INSTALL THE PHP DRIVERpecl install mongo
Wednesday, 21 July 2010
Install on ubuntu view db stats : http://localhost:28017/
Wednesday, 21 July 2010
Durability
Long long story
Durability - You had to ask
Wednesday, 21 July 2010
Examples - from the console
Wednesday, 21 July 2010
Examples - from the console
> db.accounts.count() 1> db.accounts.find().forEach(function(doc){ print(tojson(doc));});
Wednesday, 21 July 2010
Examples - from the console
> db.colors.find({name:'green'}) { "_id" : ObjectId("4bed7af40b4acd070c593ba7"), "name" : "green", "primary" : true }
> use testing switched to db testing> db.colors.insert({name:'red', primary:true})> db.colors.insert({name:'green', primary:true})> db.colors.insert({name:'blue', primary:true})> db.colors.insert({name:'purple', primary:false})> db.colors.insert({name:'orange', primary:false})> db.colors.insert({name:'yellow', primary:false})
SELECT * from colors WHERE name = 'green' ; because I am sucker.
Wednesday, 21 July 2010
Examples - from the console
db.people.update( { name:"Joe" }, { $inc: { x:1, y:1 } }, true );Upsert
db.users.find().skip(20).limit(10);Skip and Limit
db.users.find({last_name: 'Smith'}, {'ssn': 1});Limiting Fields, only get ssn
db.collection.find({ "field" : { $gt: value } } );Greater than
db.postings.find( { "author.name" : "joe" } );Values in Embeded Objects
db.myCollection.find().sort( { ts : -1 } ); // sort by ts, descending orderSort
Wednesday, 21 July 2010
Examples - Real PHP
Wednesday, 21 July 2010
Examples - Real PHP
Wednesday, 21 July 2010
OLD
Wednesday, 21 July 2010
OLD
Wednesday, 21 July 2010
Mongo Hub GUI
Wednesday, 21 July 2010
backup
-fsync (mongo command) - shutdown copy /data/db
- mongodump
Wednesday, 21 July 2010
or
Facebook still uses MySQL, a lot. Wikipedia uses MySQL, a lot. FriendFeed uses MySQL, a lot. NoSQL is a great tool, but it’s certainly not going to be your competitive edge, it’s not going to make your app hot, and most of all, your users won’t give a shit about any of this.
What am I going to build my next app on? Probably Postgres. Will I use NoSQL? Maybe. I might also use Hadoop and Hive. I might keep everything in flat files. Maybe I’ll start hacking on Maglev. I’ll use whatever is best for the job. If I need reporting, I won’t be using any NoSQL. If I need caching, I’ll probably use Tokyo Tyrant. If I need ACIDity, I won’t use NoSQL. If I need a ton of counters, I’ll use Redis. If I need transactions, I’ll use Postgres. If I have a ton of a single type of documents, I’ll probably use Mongo. If I need to write 1 billion objects a day, I’d probably use Voldemort. If I need full text search, I’d probably use Solr. If I need full text search of volatile data, I’d probably use Sphinx.
Wednesday, 21 July 2010