Sha256: b1979f266946d8278bb62a0b7ff8b3f5ade087df232b9efe97bee6254fbda822

Contents?: true

Size: 405 Bytes

Versions: 1

Compression:

Stored size: 405 Bytes

Contents

class ObjCursor
  attr_accessor :cursor
  include FromHash
  def each
    cursor.each { |x| yield(x.to_mongo_object) }
  end
  def count
    cursor.count
  end
end

module MongoPersistCollection
  def find_objects(*args)
    ObjCursor.new(:cursor => find(*args))
  end
  def find_one_object(*args)
    find_one(*args).to_mongo_object
  end
end

class Mongo::Collection
  include MongoPersistCollection
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongo_persist-0.1.0 lib/mongo_persist/mongo_ext.rb