Please sign in to comment.
Add initial support for GridFS with new fns insert-file!, fetch-files…
…, destroy-file! etc. Implementation notes: This is the bare minimum code to get data in and out of GridFS. The collections that back GridFS internally use an ObjectClass of GridFSDBFile, so the regular ClojureDBObject hack can't be used to get painless coercion. To reuse the fast conversion code in ClojureDBObject for this purpose, I've made public the static method ClojureDBObject/toClojureMap. The :gridfs hint for 'coerce' seemed less messy than leaking another function into congomongo.clj. Some reflection will probably be used in insert-file! and write-file-to, but this seems preferable than repeating the list of possible argument types for the wrapped overloaded methods. There's no atomic update support in GridFS, but an update-file! fn can be written, together with wrappers for other GridFS functionality, such as listing all files in a bucket. The Java GridFS implementation curiously leaves the uploadDate attribute of files blank by default, in addition to the contentType field. It may be desirable to fill those fields in congomongo, but I haven't done that at this stage.
- Loading branch information...
Showing with 127 additions and 6 deletions.