WebFund 2014W Lecture 13

From Soma-notes
Jump to navigation Jump to search

The video from the lecture given on February 28, 2014 is available:


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

Key difference between client-side and server-side JS: THE DOM

  • DOM = document object model
  • tree representation of an HTML document
  • with lots of access methods
  • purpose: read and change HTML page under control of JS

jQuery

  • standardized methods for accessing DOM (and other stuff)
  • pattern: specify nodes => change nodes
  • specify nodes via tag, id, & class (same identifiers used by CSS)