forked from congomongo/congomongo
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
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
4 changed files
with
127 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters