I'm trying to add a document to a collection that requires an ObjectId
and a BinData
value, but I'm not sure how to do it.
When I attempt to execute this code, I receive the following error:
TypeError: Cannot read property 'ObjectId' of undefined
.
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);
Update
I am using Meteor
Therefore, I can use
var ObjectId = Meteor.Collection.ObjectID;
. But I am unsure on how to access the BinData
.
ReferenceError: BinData is not defined