1

使用 find-by-id monger api 可以(prn (gfs/find-by-id fs id))给出:

#object[com.mongodb.gridfs.GridFSDBFile 0x5742d15e "{ \"metadata\" : { \"format\" :  null } , \"filename\" : \"blob\" , \"aliases\" :  null  , \"chunkSize\" : 261120 , \"uploadDate\" : { \"$date\" : \"2020-03-05T23:36:50.249Z\"} , \"length\" : 55602 , \"_id\" : { \"$oid\" : \"5e618d125815506bb3c72cfe\"} , \"contentType\" :  null  , \"md5\" : \"48284ab9cc81e2d079af703f5aed3267\"}"]

这就是我在启用 wrap-edn 中间件的情况下将此文件发送到客户端的方式:

  {:status (or status 200)
   :headers {"Content-Type" "application/edn"}
   :body (pr-str (gfs/make-input-file fs (gfs/find-by-id fs id)))}

但是,这会在客户端中提供以下内容:

Invalid symbol: java.lang.IllegalArgumentException:.  Format should have been EDN", :original-text "java.lang.IllegalArgumentException: No implementation of method: :to-input-stream of protocol: #'monger.gridfs/InputStreamFactory found for class: com.mongodb.gridfs.GridFSDBFile\n\tat 
4

0 回答 0