This is the code I used to initialise my CollectionFS:
Uploads = new FS.Collection('uploads', {
stores: [new FS.Store.FileSystem('uploads', {path: '~/projectUploads'})]
});
This is my CollectionFS document I've inserted as shown in Robomongo:
{
"_id" : "n3M8geaZXnNkZ7mHP",
"original" : {
"name" : "AguaBendita.jpg",
"updatedAt" : ISODate("2014-02-19T11:05:40.000Z"),
"size" : 73719,
"type" : "image/jpeg"
},
"uploadedAt" : ISODate("2015-04-04T09:24:49.433Z"),
"copies" : {
"uploads" : {
"name" : "AguaBendita.jpg",
"type" : "image/jpeg",
"size" : 73719,
"key" : "uploads-n3M8geaZXnNkZ7mHP-AguaBendita.jpg",
"updatedAt" : ISODate("2015-04-04T09:24:49.000Z"),
"createdAt" : ISODate("2015-04-04T09:24:49.000Z")
}
}
}
I know how to find
or findOne
the document based on the _id
e.g.
var testingfetchAgua = Uploads.find({_id: 'n3M8geaZXnNkZ7mHP'}).fetch();
or
var testingfetchAgua = Uploads.files.findOne({_id: 'n3M8geaZXnNkZ7mHP'}).fetch();
however I don't know how to find
or findOne
the document based on the "name" key/value inside the "original" key/value?
Is this even possible in CollectionFS?
How does one do that in a CollectionFS query?
How do you do that in a MongoDB query?
Is the query in MongoDB the same in CollectionFS?