Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 18-Apr-17 0:50am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900