WebFund 2014W Lecture 13: Difference between revisions

From Soma-notes
Line 33: Line 33:
* if others have changed documents/records, abort transactions and undo all changes
* if others have changed documents/records, abort transactions and undo all changes
* Airline example: reserve seat and record payment
* Airline example: reserve seat and record payment
* If you want transactions, use SQL (e.g., PostgreSQL, Oracle, MySQL (sort of)), at the price of some performance


==Ethics==
==Ethics==


==client-side JS==
==client-side JS==

Revision as of 19:04, 28 February 2014

MongoDB

Data "types":

  • Databases: sets of collections
  • collections: sets of documents
  • documents: sets of properties and values

Database operations:

  • create/add a database
  • drop/delete a database
  • add a collection to a database
  • remove a collection from a database
  • select a collection to use

Collection operations:

  • retrieve all documents
  • retrieve specific documents matching a set of conditions
  • add/insert a document
  • remove/delete a document
  • replace a set of document

Document operations:

  • stored as a JS object with _id unique identifier
  • set/change value of a property
  • retrieve value of a property
  • => key/value store or associative array

Transactions: (not in MongoDB)

  • start a transaction
  • specify queries to match documents/records
  • specify changes to those documents/records
  • commit changes if none of the specified data has been changed by others
  • if others have changed documents/records, abort transactions and undo all changes
  • Airline example: reserve seat and record payment
  • If you want transactions, use SQL (e.g., PostgreSQL, Oracle, MySQL (sort of)), at the price of some performance

Ethics

client-side JS