如何在MongoDB的ajax中显示图像文件

时间:2016-09-01 09:47:38

标签: jquery json ajax mongodb gridfs

我在mongoDB GridFs Image Store中的新功能.. 在我的项目中,我需要显示从MongoDB返回的产品图像,我使用ajax响应从MongoDB获取Json Image数组 我的Json数组是:

[
{
 "_id" : "1001",
 "chunkSize" : NumberLong(262144),
  "length" : NumberLong(19642),
  "md5" : "2ee6b6adec30c23c6d7bff6a835a956b",
  "filename" : "photo3.jpg",
  "contentType" : null,
  "uploadDate" : ISODate("2013-11-04T19:54:49.782Z"),
  "aliases" : null
},
{
  "_id" : "1002",
  "chunkSize" : NumberLong(262145),
  "length" : NumberLong(19643),
  "md5" : "fafa5efeaf3cbe3b23b2748d13e629a1",
  "filename" : "photo2.jpg",
  "contentType" : null,
  "uploadDate" : ISODate("2013-11-04T19:54:49.782Z"),
  "aliases" : null
},
{
  "_id" : "1003",
  "chunkSize" : NumberLong(262145),
  "length" : NumberLong(19643),
  "md5" : "9d377b10ce778c4938b3c7e2c63a229a",
  "filename" : "photo1.jpg",
   "contentType" : null,
  "uploadDate" : ISODate("2013-11-04T19:54:49.782Z"),

}
]

如何在jquery中的img.src中显示图像文件 在此先感谢

0 个答案:

没有答案