title: Iterate Array of Objects, and save each to MongoDB
body: <p>I want to save/insert each Object from the Array into my MongoDB, after receiving it from a Facebook endpoint. </p>
  
  <p>How would I iterate over the returned Array of Objects and then save it to my mongoDB? :)</p>
  
  <p><strong>Code from my Route, where I receive the data from the Facebook API with superagent</strong></p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  var request = require('superagent')
  var utils = require('../utils')
  
  router.get('/facebook', function(req, res, next) {
  
    var url = "https://graph.facebook.com/v2.9/xxxxxxxx"
  
    request
      .get(url)
      .set('Accept', 'application/json')
      .end(function(err, result){
        var parse = JSON.parse(result.text)
        res.json({
          confirmation: 'success',
          response: parse
        })
      });
  
  });
  
  module.exports = router;
  </code></pre>
  
  <p><strong>Each Object looks like this:</strong></p>
  
  <pre><code>"confirmation": "success",
  "response": {
  "data": [
  {
  "message": "Søger  et godt hjulsæt til Max 1000\nkr.1,000 - Løsning, Vejle, Denmark\n\nVed at ser er en masse fine hjulsæt er er i overskud der ude er der nogen der har et rigtig fint hjulsæt  i vil sælge mig ?",
  "from": {},
  "permalink_url": "https://www.facebook.com/groups/306677009409252/permalink/1333896396687303/?sale_post_id=1333896396687303",
  "type": "photo",
  "created_time": "2017-04-25T14:26:39+0000",
  "picture": "https://scontent.xx.fbcdn.net/v/t1.0-0/q81/s130x130/18157109_10155237818408609_6730263000530603997_n.jpg?oh=e4198809641ce4549592065f9ce1d522&amp;oe=5993A162",
  "id": "306677009409252_1333896396687303",
  "attachments": {}
  },
  {
  "message": "Bontrager cykelhjelm\nkr.250 - Lemvig\n\nNy cykelhjelm  bontrager starvos str S\n51-57 cm ny og i original emballage. Ny pris 649 kr",
  "from": {
  "name": "Tanja Olsen",
  "id": "10155372412188754"
  },
  "name": "Photos from Tanja Olsen's post",
  "permalink_url": "https://www.facebook.com/groups/306677009409252/permalink/1333870013356608/?sale_post_id=1333870013356608",
  "type": "photo",
  "created_time": "2017-04-25T13:49:26+0000",
  "picture": "https://scontent.xx.fbcdn.net/v/t1.0-0/s130x130/18118873_10155371971413754_3345993522211660552_n.jpg?oh=de0d10dc9e0589789e023819402ef399&amp;oe=598FAE09",
  "id": "306677009409252_1333870013356608",
  "attachments": {}
  }]
  </code></pre>
  
  <p><strong>My Model/Schema</strong></p>
  
  <pre><code>var mongoose = require('mongoose')
  
  var FeedSchema = new mongoose.Schema({
      type: {type: String, default: ''},
      title: {type: String, default: ''},
      image: {type: String, default: ''},
      description: {type: String, default: ''},
      timestamp: {type: Date, default: Date.now}
  })
  
  module.exports = mongoose.model('FeedSchema', FeedSchema)
  </code></pre>
  
  <p><strong>What I have attempted but didnt work yet</strong></p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  var request = require('superagent')
  var utils = require('../utils')
  var Feed = require('../models/Feed')
  
  router.get('/facebook', function(req, res, next) {
  
    var url = "https://graph.facebook.com/v2.9/XXXXXXX"
    var bulk = Feed.initializeUnorderedBulkOp();
  
    request
      .get(url)
      .set('Accept', 'application/json')
      .end(function(err, result){
        var parse = JSON.parse(result.text)
  
        var object = parse.data
  
        array.forEach((object) =&gt; {
          bulk.insert({
            type: object.type,
            title: object.title,
            image: object.image,
            description: object.description
          })
        })
        bulk.execute();
    });
  
  
  });
  
  module.exports = router;
  </code></pre>