使用NodeJS显示Mongodb的图像

时间:2014-10-10 09:15:14

标签: node.js angularjs mongodb mongoose

我有一个" 图片"和" image_ids "在我的mongoDB中:

图片

{
        "_id" : ObjectId("542e65368a1cec1227ae2bac"),
        "reference" : "5424991"
}

images_ids:

{
        "_id" : ObjectId("542e652995ac12ed3fecb85f"),
        "image" : "D0000001.PNG",
        "fid" : ObjectId("542e65368a1cec1227ae2bac"),
        "reference" : "5424991"
}

如何使用NodeJS显示D0000001.PNG?我的意思是,与API进行链接。

[编辑]我们也

fs.chunks:

{
        "_id" : ObjectId("542e684a8a1cec178a172673"),
        "n" : 1,
        "data" : BinData(0,"2N6DSSfbCN/LLacNDYrJUQDEZgimMUwFpQGoJP0RU19Bi4PM82DjrUnKhE/P9v7P8ZveD1oDpFBM0iml9NE3WQmAvYFoG+nhD73Jm4N9b4LpylaAN5Ef+gVdgGSTAfSUwOikXoVick5pSQCkRmTCU5NT9VVfjHdAx74/ZhFRj+TIRjzlAhzkACBElzgMwGCo7tX+FYrpQLJ5KRmXiwFFwsNtHHzXiK1eu+CG1FumhGpA/qdG8CdDgD1xUHEcerMGO/eLGR9ML7ni/VjXxWzqp2j5DG2/WuKNv7xd3Kz/vr0MctJhuaBIl35YrKhdLnzqDa0uDa6bm4jz+eNyAI2hQbayGo4kVPFe8W7wFpY7qfBvnB9kbocxfZSdADDUNwYaydpT8lIcKEN9XfQJOYZvHp0El"),
        "files_id" : ObjectId("542e684a8a1cec178a172671")
}

fs.files:

{
        "_id" : ObjectId("542e65378axdeckhb0"),
        "uploadDate" : ISODate("2012-11-01"),
        "length" : 15673,
        "chunkSize" : 33222,
        "md5" : "f66e6654854a28e3672cfhds334d223b55a1"
}

感谢您的帮助!

0 个答案:

没有答案