How to insert a document with a BinData-Value into a collection?


#1

I need to insert a document into a collection, which has a BinData value. Therefore I don’t know how to insert it.

With this code I get the error ReferenceError: BinData is not defined.

server/fixtures.js

var ObjectId = Mongo.ObjectID;
var chunk = {
            "_id"     : ObjectId("57a9be3c89c1e4b50c574e3a"),
            "files_id": ObjectId("5113b0062be53b231f9dbc11"),
            "n"       : 0,
            "data"    : BinData(0, "/9j/4AAQSkZJRgA...and...so...on../2Q==")
        };

db.mediafiles.chunks.insert(chunk);