How to fetch file stored in mongodb at command line
fs.chunks (sample content)
{
"_id": ObjectId("58ef70488ec6a64120b1d627"),
"n": NumberInt(0),
"data": "<Mongo Binary Data>",
"files_id": {
"category": "asset",
"name": "LC.jpg",
"course": "CS201",
"tag": "c4x",
"org": "UniversityZ",
"revision": null
}
}
fs.files (sample content)
{
"_id": {
"category": "asset",
"name": "LC.jpg",
"course": "CS201",
"tag": "c4x",
"org": "UniversityZ",
"revision": null
},
"contentType": "image/jpeg",
"locked": false,
"chunkSize": NumberInt(261120),
"content_son": {
"category": "asset",
"name": "LC.jpg",
"course": "CS201",
"tag": "c4x",
"org": "UniversityZ",
"revision": null
},
"filename": "/c4x/UniversityZ/CS201/asset/LC.jpg",
"displayname": "LC.jpg",
"length": NumberInt(178417),
"import_path": null,
"uploadDate": ISODate("2017-04-13T12:34:16.436Z"),
"thumbnail_location": [
"c4x",
"UniversityZ",
"CS201",
"thumbnail",
"LC.jpg",
null
],
"md5": "da3518a71e1fffb9afc5bf42c840086b"
}
What I have tried:
A.
$mongofiles -h host -u user -ppasswd -d database get '/c4x/UniversityZ/CS201/asset/LC.jpg'
connected to: host
assertion: 13325 couldn't open file: /c4x/UniversityZ/CS201/asset/LC.jpg
Note: user is having "role" as "readWrite".
B,
$mongofiles -h host -u user -ppasswd -d database get 'LC.jpg'
connected to: host
ERROR: file not found