Presentation is loading. Please wait.

Presentation is loading. Please wait.

SE-2840 Dr. Mark L. Hornick1 MongoDB A persistent data store.

Similar presentations


Presentation on theme: "SE-2840 Dr. Mark L. Hornick1 MongoDB A persistent data store."— Presentation transcript:

1 SE-2840 Dr. Mark L. Hornick1 MongoDB A persistent data store

2 What is a database? Like a file, a database is used to persistently store information outside of an application The app can stop or crash, but the data persists and is still available after restart Unlike a file, a database is structured, allowing for easy manipulation (CRUD) Create Read Update Delete SE-2840 Dr. Mark L. Hornick2

3 MongoDB stores data JSON db.restaurants.insert( { "address" : { "street" : "2 Avenue", "zipcode" : "10075", "building" : "1480", "coord" : [ -73.9557413, 40.7720266 ], }, "borough" : "Manhattan", "cuisine" : "Italian", "grades" : [ { "date" : "2014-10-01", "grade" : "A"}, { "date" : "2014-01-16", "grade" : "B"} ], "name" : "Vella } ); SE-2840 Dr. Mark L. Hornick3

4 MongoDB stores data JSON var restaurant = { "address" : { "street" : "2 Avenue", "zipcode" : "10075", "building" : "1480", "coord" : [ -73.9557413, 40.7720266 ], }, "borough" : "Manhattan", "cuisine" : "Italian", "grades" : [ { "date" : "2014-10-01", "grade" : "A"}, { "date" : "2014-01-16", "grade" : "B"} ], "name" : "Vella }; db.restaurants.insert( restaurant ); SE-2840 Dr. Mark L. Hornick4

5 Once stored, data can be retrieved through various queries var favorites = db.restaurants.find( {“borough”:”Manhattan”); // favorites is a JSON array of ALL restaurants // in Manhattan SE-2840 Dr. Mark L. Hornick5


Download ppt "SE-2840 Dr. Mark L. Hornick1 MongoDB A persistent data store."

Similar presentations


Ads by Google