# File lib/mongoid/contexts/mongo.rb, line 339
      def caching(&block)
        if defined? @collection
          @collection.each(&block)
        else
          @collection = []
          execute.each do |doc|
            @collection << doc
            yield doc if block_given?
          end
        end
      end