Sha256: 23a82cd256956d9f3ac18e0822dcaf80f4fe1a97c29c0c98c5a8a82ca0a34545
Contents?: true
Size: 435 Bytes
Versions: 6
Compression:
Stored size: 435 Bytes
Contents
require 'mongo' class DataStore def initialize @@mongo_db ||= Mongo::MongoClient.new("localhost", 27017) @@db ||= @@mongo_db.db("development") end def query(collection, query) puts "QUERY: #{collection} - #{query.inspect}" 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 end end
Version data entries
6 entries across 6 versions & 1 rubygems