app/volt/tasks/live_query/data_store.rb in volt-0.8.4 vs app/volt/tasks/live_query/data_store.rb in volt-0.8.5
- old
+ new
@@ -1,18 +1,21 @@
require 'mongo'
class DataStore
def initialize
- @@db = Volt::DataStore.fetch
end
+ def db
+ @@db ||= Volt::DataStore.fetch
+ end
+
def query(collection, query)
query = query.dup
query.keys.each do |key|
if key =~ /_id$/
# query[key] = BSON::ObjectId(query[key])
end
end
- @@db[collection].find(query).to_a
+ db[collection].find(query).to_a
end
end