Monday, November 26, 2018

JSON Examples

use ProductReveiws

collections are like tables--collections of JSON objects

collection products

{
   '_id' : 1,
   'productname' : 'Ipad mini',
   'price' : [300.99,600.99,800.99],
   'company' : 'Apple',
   'storage' : '128 gigabytes'
}

collection reviewers
{
    'reviewername' : 'Norman Bates',
    'email' : 'nb@gmail.com'
    
}

collection reviews
[{
   'reviewtitle' : 'Ipad minis, a nice size',
   'reviewdate' : '11/26/2018',
   'rating' : 4,
   'reviewtext' : 'easier to hold than a full sized ipad',
   'product' : {
                 'productid' : 1, 
                 'productname' : 'Ipad mini',
                 'productprice' : 300.99
                },
    'reviewer' : {
                   'reviewername': 'Norman Bates',
                   'email' : 'nb@gmail.com'
                  }

}, 
{
   'reviewtitle' : 'Mac Pro, a nice size',
   'reviewdate' : '11/28/2018',
  
   'reviewtext' : 'easier to hold than a full sized ipad',
   'product' : {
                 'productid' : 2, 
                 'productname' : 'Mac Pro',
                 'productprice' : 1200.99,
   'company' : 'Apple',
                 'soldat' : 'Applestore'
                },
    'reviewer' : {
                   'reviewername': 'John Manning',
                   'email' : 'jm@gmail.com'
                  }

}], 

No comments:

Post a Comment