• Big data • Flexible data models ONLY KEY/VALUE STORES DOCUMENT DB GRAPH STORES wide column stores memcached db project voldemort redis dynamo mongo db couch base neo4j orient db allegro virtuoso big table hbase accumulo cassandra
db.foo.insert({name:”Sauron”, type:”bad-ass”, address:”Mordor”, eyes:1})! SELECT all documents in a collec7on > db.foo.find()! SELECT some documents in a collec7on > db.foo.find({eyes:1}) > db.foo.find({eyes:1, type:”bad-ass”})! UPDATE a document in a collec7on > db.foo.save({_id:10, name:”Sauron”, type:”good boy”})! > db.foo.update({type:”bad-ass”},{$inc:{eyes:1}},{multi:true})! DELETE all documents in a collec7on > db.foo.remove()! DELETE some documents in a collec7on > db.foo.remove({eyes:1})!
weak concern fast writes “In some failure cases, write opera3ons issued with weak write concerns may not persist.” “With stronger write concerns, clients wait aAer sending a write opera3on for MongoDB to confirm the write opera3on.” errors ignored w:-1 unacknowledged w:0 acknowledged w:1 journaled w:1,j:true replica acknowledged w:n (n>1) It does not acknowledge write op. and the client cannot detect failed write op. It does not acknowledge write op. but driver aUempt to handle network errors. It confirms the receipt of the write op. allowing clients to catch errors. DEFAULT It confirms the receipt of the write op. only aWer commiXng the data to journal. It confirms the receipt of the write op. aWer acknowledging primary and n-‐1 secondaries.
hash based sharding { shard key is immutable . easily divisible among shards . high degree of randomness . targets a single shard . compound shard key > db.runCommand({ !shardcollection:”test.users”, ! ! ! ! !key: { email:1}})! split--ting Balanc ing triggered automatically by a mongos if a chunk goes beyond max size (default 64mb) triggered automatically by a mongos if there is a chunk imbalance (8+ chunks)