Skip to content

Instantly share code, notes, and snippets.

@jrygh00
Last active August 29, 2015 13:59
Show Gist options
  • Save jrygh00/10771283 to your computer and use it in GitHub Desktop.
Save jrygh00/10771283 to your computer and use it in GitHub Desktop.
MongoDb

MongoDb

##Basic History

  • Leading NoSQL Database / Document Oriented Database
  • Name is from HuMONOGOus
  • Developed by 10gen
  • first released in 2009
  • Open Source
  • Written in C++
  • Free & Commercial License
  • Adopted by Craigslist, eBay, Foursquare, and others.

##Features

  • No SQL or Joins, so faster and better for scale and benchmarking
  • Stages data to be written a later time, so not as secure as relational databases
  • Runs on multiple computers (a big data solution)
  • can use Javascipt functions
  • longitude and lattitude native
  • Map Reduce combines features for sorting.
  • Shardes (stores large files without complicating your stack)
  • Atomic Modifiers
  • Location logitude and latitude are native
  • No Complex transactions Support (can not rollback on multiple transactions)
  • No Constraints Support (implemented at the application level instead)

A Description from The Mongo Man:

"MongoDB is recognized as the leading NoSQL database it delivers faster time to market, higher developer productivity, and better developer experience. Its features include a JSON data model with dynamic schemas, extensive driver support, auto-sharding, built-in replication and high availability, full and flexible index support, rich queries, aggregation, in-place updates and GridFS for large file storage."

#Relational DB vs noSQL DB Tradeoff between functionality (Relational Databases preferred - think tables schemas) and performance (noSQL wins - think collections, Bson(like JSON format))

Collections can have a varying number of fields and nested values, or several values Collections look like { _id: "124", name: "bob, address: [one address, address two...]}

##Broader Database Topics: Relational Databases - traditionlal soltuion to flat file systems, until big data came along NoSQL Databases - horizontal scalability - more and more computers as you need more power 3 NoSQL Database Types:

  • Key Value (Memcached, Coherence, Redis)
  • Tabular (BigTable, Hbase, Accumulo)
  • Document Oriented (Mongo, Counch, Cloudant)

##What is a database shard? "Horizontal partitioning is a database design principle whereby rows of a database table are held separately, rather than being split into columns (which is what normalization and vertical partitioning do, to differing extents). Each partition forms part of a SHARD, which may in turn be located on a separate database server or physical location."

Collections can have a varying number of fields and nested values, or several values Collections look like { _id: "124", name: "bob, address: [one address, address two...]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment