var MongoClient = require('mongodb').MongoClient
  , assert = require('assert');

// Connection URL
var url = 'mongodb://localhost:27017/myproject';
// Use connect method to connect to the Server
MongoClient.connect(url, function(err, db) {
  assert.equal(null, err);
  console.log("Connected correctly to server");

  // insertDocuments(db, function() {
  //   updateDocument(db, function() {
  //     db.close();
  //   });
  // });
});

var insertFood = function(db, food, number, expiration){
    var collection = db.collection('inventory');

    // insert the food and its attributes
    collection.insert(
        {
            "quantity": number,
            "type": food,
            "exp": expiration
        });
}

@@ -45,12 +45,13 @@
 ient
-%0A  ,
+;%0Avar
  ass
@@ -314,32 +314,39 @@
 %22);%0A
-%0A  //
+ 
  insert
-Documents(db
+Food(db, 5, %22apple%22, 14
 , fu
@@ -357,35 +357,45 @@
 on()
- 
 %7B%0A  
-//   updateDocument(db
+    insertFood(db, 3, %22orange%22, 7
 , fu
@@ -406,15 +406,15 @@
 on()
- 
 %7B%0A  
-//
+   
     
@@ -432,18 +432,17 @@
 ;%0A  
-//
+ 
    %7D);%0A 
  // 
@@ -437,19 +437,16 @@
    %7D);%0A 
- //
  %7D);%0A%7D);
@@ -481,32 +481,33 @@
 db, 
-food, number, expiration
+num, name, days, callback
 )%7B%0A 
@@ -661,11 +661,8 @@
  num
-ber
 ,%0A  
@@ -679,20 +679,20 @@
 %22type%22: 
-food
+name
 ,%0A      
@@ -708,18 +708,175 @@
 p%22: 
-expiration
+days%0A        %7D, function(err, result)%7B%0A            assert.equal(err, null);%0A            console.log(%22Inserted food into the inventory.%22);%0A            callback(result);
 %0A   
@@ -885,9 +885,10 @@
    %7D);%0A%7D
+;
 %0A

insert working