3

GridFS中有文件:

In [1]: import pymongo

In [2]: c = pymongo.Connection('localhost', 49996)

In [3]: gfsf = c.wss_test.fs.files.find()

In [4]: gfsf.next()
Out[4]: 
{u'_id': ObjectId('51ad37067662579917000000'),
 u'chsum': u'18848aca1fc0980524d84aed3cc87dce',
 u'chunkSize': 1048576L,
 u'compressed': 0L,
 u'creationDate': u'2013-06-04T00:38:30',
 u'json': 1L,
 u'length': 15L,
 u'md5': u'18848aca1fc0980524d84aed3cc87dce',
 u'uploadDate': datetime.datetime(2013, 6, 4, 0, 38, 30)}

但是 mongofiles 只吐出长度 - 没有文件名:

$ mongofiles -h localhost:49996 -d wss_test list
connected to: localhost:49996
    15
    62
    14

由于所有mongofiles操作都是按文件名,现在怎么办?

4

1 回答 1

4

是的,mongofiles 仅适用于文件名,这在 GridFS 规范中是完全可选的。如果您需要通过 mongofiles 处理文件,请确保将文件名添加到文件中。

于 2013-06-05T22:58:34.623 回答