lib/mongomapper/document.rb in hashrocket-mongomapper-0.3.13 vs lib/mongomapper/document.rb in hashrocket-mongomapper-0.3.14
- old
+ new
@@ -58,16 +58,16 @@
find_every(options)
end
def find_by_id(id)
criteria = FinderOptions.to_mongo_criteria(:_id => id)
- if doc = collection.find_first(criteria)
+ if doc = collection.find_one(criteria)
new(doc)
end
end
def count(conditions={})
- collection.count(FinderOptions.to_mongo_criteria(conditions))
+ collection.find(FinderOptions.to_mongo_criteria(conditions)).count
end
def create(*docs)
instances = []
docs = [{}] if docs.blank?