问题描述
如何在命令行中获取存储在mongodb中的文件
fs.chunks(样本内容)
{
_id:ObjectId(58ef70488ec6a64120b1d627),
n:NumberInt(0),
data :< Mongo二进制数据>,
files_id:{
类别:资产,
名称 :LC.jpg,
课程:CS201,
tag:c4x,
org :UniversityZ,
revision:null
}
}
fs.files(样本内容)
{
_id:{
category :资产,
名称:LC.jpg,
课程:CS201,
tag :c4x,
org:UniversityZ,
revision:null
},
contentType:image / jpeg,
已锁定:false,
chunkSize:NumberInt(261120),
conten t_son:{
类别:资产,
名称:LC.jpg,
课程: CS201,
tag:c4x,
org:UniversityZ,
revision:null
},
文件名:/ 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,
缩略图,
LC.jpg,
null
],
md5:da3518a71e1fffb9afc5bf42c840086b
}
我尝试过:
A.
$ mongofiles -h host -u user -ppasswd -d database get' /c4x/UniversityZ/CS201/asset/LC.jpg'
关联:主人
断言:13325 cou不打开文件:/c4x/UniversityZ/CS201/asset/LC.jpg
注意:用户的角色为readWrite。
B,
$ mongofiles -h host -u user -ppasswd -d database get'LC.jpg'
连接到:主机
错误:找不到文件
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
推荐答案
这篇关于如何在命令行获取存储在mongodb中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!