Your SlideShare is downloading. ×
Bar Camp Auckland - Mongo DB Presentation BCA4
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Bar Camp Auckland - Mongo DB Presentation BCA4

1,647
views

Published on

Bar Camp Auckland Slides on Mongo DB

Bar Camp Auckland Slides on Mongo DB

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,647
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. SELECT wages FROM companies WHERE coders = “sucker” NO, NO SQL Wednesday, 21 July 2010
  • 2. Noise Wednesday, 21 July 2010
  • 3. Lots of pretty pictures to fool you. Wednesday, 21 July 2010
  • 4. Its a change Its Not Relational - Get Over It. It is a rich document store. schemas for mongo : http://www.kurl.ws/wJ Wednesday, 21 July 2010
  • 5. What 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: • 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. schemas for mongo : http://www.kurl.ws/wJ Wednesday, 21 July 2010
  • 6. Supported Drivers mongodb.org Supported • C • C++ • Java • Javascript • Perl • PHP • Python • Ruby Community Supported • Lua • REST • node.js • C# and .NET • Objective C • Clojure • PHP • ColdFusion • PowerShell • Delphi • Python • Erlang • Ruby • Factor • Scala • Fantom • Scheme (PLT) • F# • Smalltalk • Go • Groovy • Haskell • Javascript more info: www.mongodb.org Wednesday, 21 July 2010
  • 7. Install on ubuntu EDIT YOUR SOURCES FILE nano /etc/apt/sources.list ADD THE FOLLOWING LINE deb http://downloads.mongodb.org/distros/ubuntu 9.4 10gen NOW UPDATE APT apt-get update apt-get install mongodb-stable apt-get install php5-dev INSTALL THE PHP DRIVER pecl install mongo All Instructions http://kurl.ws/wH Wednesday, 21 July 2010
  • 8. Install on ubuntu view db stats : http://localhost:28017/ Wednesday, 21 July 2010
  • 9. Durability Durability - You had to ask Long long story Wednesday, 21 July 2010
  • 10. Examples - from the console Wednesday, 21 July 2010
  • 11. Examples - from the console > db.accounts.count() 1 > db.accounts.find().forEach(function(doc){ print(tojson(doc)); }); Wednesday, 21 July 2010
  • 12. Examples - from the console > 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. > db.colors.find({name:'green'}) { "_id" : ObjectId("4bed7af40b4acd070c593ba7"), "name" : "green", "primary" : true } Wednesday, 21 July 2010
  • 13. Examples - from the console Skip and Limit db.users.find().skip(20).limit(10); Limiting Fields, only get ssn db.users.find({last_name: 'Smith'}, {'ssn': 1}); Greater than db.collection.find({ "field" : { $gt: value } } ); Values in Embeded Objects db.postings.find( { "author.name" : "joe" } ); Sort db.myCollection.find().sort( { ts : -1 } ); // sort by ts, descending order Upsert db.people.update( { name:"Joe" }, { $inc: { x:1, y:1 } }, true ); Wednesday, 21 July 2010
  • 14. Examples - Real PHP Wednesday, 21 July 2010
  • 15. Examples - Real PHP Wednesday, 21 July 2010
  • 16. OLD Wednesday, 21 July 2010
  • 17. OLD Wednesday, 21 July 2010
  • 18. Mongo Hub GUI Wednesday, 21 July 2010
  • 19. backup -fsync (mongo command) - shutdown copy /data/db - mongodump Wednesday, 21 July 2010
  • 20. 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