Module: Mongo::GridExt::InstanceMethods
- Included in:
- Mongo::Grid, Mongo::GridFileSystem
- Defined in:
- lib/mongo/gridfs/grid_ext.rb
Instance Method Summary collapse
-
#exist?(selector) ⇒ nil, Hash
Check the existence of a file matching the given query selector.
Instance Method Details
#exist?(selector) ⇒ nil, Hash
Check the existence of a file matching the given query selector.
Note that this method can be used with both the Grid and GridFileSystem classes. Also keep in mind that if you’re going to be performing lots of existence checks, you should keep an instance of Grid or GridFileSystem handy rather than instantiating for each existence check. Alternatively, simply keep a reference to the proper files collection and query that as needed. That’s exactly how this methods works.
52 53 54 |
# File 'lib/mongo/gridfs/grid_ext.rb', line 52 def exist?(selector) @files.find_one(selector) end |