我通过 mongofiles 在 GridFS 上保存了一个文件
$ mongofiles -d dba put file.txt
connected to: 127.0.0.1
added file: { _id: ObjectId('50c0a48f8d1d53325a7d7b01'), filename: "file.txt", chunkSize: 262144, uploadDate: new Date(1354802319244), md5: "a6039c33d297d12d0dfb9b1a99bda542", length: 3527 }
done!
$ mongofiles -d dba list
connected to: 127.0.0.1
file.txt 3527
我有一个 Django 和 mongoengine 的模型,定义为
class IFile(Document):
iptr = FileField(required=True)
如何从 mongodb shell 将此文件保存在 IFile 的实例中?
db.ifile.save({"iptr" : ??})
谢谢