bguerout/jongo — pull request #131 by olim7t (2013-05-02 10:31:41+00:00)
Title: Issue #130: compatibility issue with GridFS.

In `BsonDBDecoder#createObject`, fallback to default decoding if we detect that the collection is GridFS-related. The returned object is a `GridFSDBFile`, not a `RelaxedLazyDBObject`.

Note that this defeats the performance optimization that `RelaxedLazyDBObject` was trying to achieve: if the user later maps the results to another class, the decoding occurs twice (bytes -> `RelaxedLazyDBObject` -> custom class). I think this is acceptable in that case.

Also handled the case where the user doesn't want to map to a custom class, but get `GridFSDBFile`s directly. Since we know that the decoder already returns objects of the right type, the handler only needs to cast. Added `RawResultHandler` to that purpose:

```java
import static org.jongo.RawResultHandler.asRaw;
GridFSDBFile f = jongo.getCollection("fs.files")
.findOne()
.map(asRaw(GridFSDBFile.class));
```