How to upload blob object of type video/webm from nodejs to Mongo DB?
<p>I have to upload video blob object to Mongo DB using NodeJS.
For video i am using video.js <a href="https://github.com/collab-project/videojs-record" rel="nofollow noreferrer">https://github.com/collab-project/videojs-record</a>
I am sending blob object to NodeJS using Ajax call like below.</p>

<pre><code>var file={
  name:'abc',
  data: player.recordedData.video
};
$.ajax({
        type: 'POST',
        url: '/uploadVideo',
        data: file,
        dataType: 'JSON'

}).done(function(data) {
                alert("success");
});
</code></pre>

<p>Here file is JSON object i wanted to save in my collection containing other fields like file name,blob data etc. At Node.js end I have below code</p>

<pre><code>router.post('/uploadVideo',function (req, res ,next) {
    var file=req.body;
    console.log("file"+file);
    var collection = db.get('test');
                collection.insert(file, function(err, result){
                console.log('video saved in mongo db');
                    res.send(file);
                });

});
</code></pre>

<p>Console statement in which file object is printed works fine.
But getting 500 error while inserting the JSON in mongo DB collection.</p>

<p>Can anyone provide me a solution for inserting blob in collection? Also let me know if my code has any bug.
Thanks</p>