Sha256: 1876432d9b0c9813996e9fdbcf41eeccd172c46687f86512ebc74917b5129955

Contents?: true

Size: 352 Bytes

Versions: 6

Compression:

Stored size: 352 Bytes

Contents

require 'mongo'

class DataStore
  def initialize
  end

  def db
    @@db ||= Volt::DataStore.fetch
  end

  def query(collection, query)
    # Extract query parts
    query, skip, limit = query

    cursor = db[collection].find(query)
    cursor = cursor.skip(skip) if skip
    cursor = cursor.limit(limit) if limit

    return cursor.to_a
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
volt-0.8.21 app/volt/tasks/live_query/data_store.rb
volt-0.8.20 app/volt/tasks/live_query/data_store.rb
volt-0.8.19 app/volt/tasks/live_query/data_store.rb
volt-0.8.18 app/volt/tasks/live_query/data_store.rb
volt-0.8.17 app/volt/tasks/live_query/data_store.rb
volt-0.8.16 app/volt/tasks/live_query/data_store.rb