Your SlideShare is downloading. ×
  • Like
PostgreSQLからMongoDBへ
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

PostgreSQLからMongoDBへ

  • 4,536 views
Published

原宿のセレクトショップアシストオンの通販サイトを、インフラの交換を含めてMongoDBかする際のあれこれ。

原宿のセレクトショップアシストオンの通販サイトを、インフラの交換を含めてMongoDBかする際のあれこれ。

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
4,536
On SlideShare
0
From Embeds
0
Number of Embeds
8

Actions

Shares
Downloads
31
Comments
0
Likes
2

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
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Transcript

  • 1. PostgreSQLMongoDB CTO @basuke
  • 2. not onlybut also
  • 3. http://www.assiston.co.jp/•• ~1000• 30~80 PV
  • 4. •••• Google
  • 5. ••••
  • 6. MongoDB ( )
  • 7. • PostgreSQL 7.4 => 8.1• PHP 4.3 => 4.4 => 5.1•
  • 8. • MongoDB 1.6.3• PHP 5.3• Lithium••
  • 9. Lithium• http://lithify.me/• 5.3• CakePHP• MongoDB / CouchDB• ↑ RDB w
  • 10. PHP MongoDB • Lithium • pecl mongo •
  • 11. Item::find(all, array( conditions => array( category => $tag, visible => true, ), order => array( position=>DESC, id => DESC), ));
  • 12. $item_collection->find(array( category => $tag, visible => true, )).sort(array( position=>-1, id => -1), ));
  • 13. • mongoimport / mongoexport • JSON • JSON• PHP••
  • 14. • mongoimport -d assiston -c items --drop --file items.dump {"no" : 123456, "items" : [{"at" : 1285679232000}}
  • 15. Mongo Extended JSON• http://www.mongodb.org/display/DOCS/Mongo +Extended+JSON• $binary, $date, $oid• $date milliseconds • PHP 32bit int
  • 16. • • PHP JSON• TIMESTAMP json_encode • 2010-12-10 17:20:21 => 1291969221 • 1291969221 sec => "||date:1291969221000||" • JSON • "||date:1291969221000||" => Date(1291969221000)
  • 17. • PHP w • Python OK • pgmongo
  • 18. 1: atomic•• ••
  • 19. CREATE TABLE ORDERS ( id SERIAL PRIMARY KEY, total INTEGER NOT NULL, { ... no: integer,); total: integer, items: [CREATE TABLE ORDER_ITEMS ( { price: integer, ...}, id SERIAL PRIMARY KEY, ] order_id INTEGER ... REFERS TO ORDERS, } price INTEGER NOT NULL, ...);
  • 20. 2:• ObjectID•• function(seqname) { return db.sequences.findAndModify({ query:{_id:seqname}, update: {$inc: {val:1}}, upsert: true, new: true}).val; }• db.system.js • db.eval("return sequence(abc)")
  • 21. 3: mongo on github• https://github.com/mongodb/mongo/tree/ master/jstests• MongoDB JavaScript
  • 22. Thank you.http://basuke.com/