title: Mongodb storing JSON file in binary form
body: <p>I'm new to Mongodb and Backend Development. I have a created a system where a user can create a json. I'm storing the json in the data base but when I retrieve the data is appearing as Binary Data. How do I convert this to JSON. There is no converter online, I have google extensively. Thanks. </p>
  
  <p>This is what I'm getting back. </p>
  
  <p>{ _bsontype: 'Binary',
    sub_type: 0,
    position: 1269,
    buffer:  }</p>
  
  <p>This is the Model </p>
  
  <pre><code>   // app/models/project.js
    // load the things we need 
   var mongoose = require('mongoose');
  
   // define the schema for our project model
       var projectSchema = mongoose.Schema({
  
  
               id        : String,
               allwork :[ 
                        {
  
                                        protocol     : String,
                                       name         : String,
                                       json         : Object
                      }
                     ]
  
  
  
    });
  
  
  
    // create the model for users and expose it to our app
  
    module.exports = mongoose.model('Project', projectSchema);
  </code></pre>
  
  <p>This is the Query</p>
  
  <pre><code>  var Project = require('./app/models/project');
     Project.findOne({ 'id' : 'pop'  }, function(err, callback) {
      if (err) return "Error searching person";
      if(callback) {
        console.log(callback.allwork);
        for(var i = 0; i &lt; callback.allwork.length; i++) {
             if(callback.allwork[i].name == "zingzong"){
  
            console.log(callback.allwork[i].json);
  
         }
    }
  //socket.emit('callback_allwork', callback.allwork);
      }
      });
    });
  </code></pre>
  
  <p>This logs the buffer with binary data instead of the json that i originaly saved.</p>
  
  <p>This is the function to save the json</p>
  
  <pre><code>                        callback.allwork.push({
                  protocol : a.user.project.protocol,
                  name : a.user.project.name,
                  json : a.user.project.json
              })
  
                  callback.save(function (err) {
                  if(!err) {
                      global.mess = "Project save succesfully"    ;   
                      return;
                      }
  
                          });
  </code></pre>