Class: Wonkavision::Analytics::Persistence::MongoStore

Inherits:
Store
  • Object
show all
Defined in:
lib/wonkavision/plugins/analytics/persistence/mongo_store.rb

Instance Attribute Summary

Attributes inherited from Store

#owner

Instance Method Summary collapse

Methods inherited from Store

[], []=, #add_facts, #execute_query, inherited, #remove_facts, #update_aggregation, #update_facts

Constructor Details

#initialize(facts) ⇒ MongoStore

Returns a new instance of MongoStore.



6
7
8
# File 'lib/wonkavision/plugins/analytics/persistence/mongo_store.rb', line 6

def initialize(facts)
  super(facts)
end

Instance Method Details

#[](document_id) ⇒ Object



26
27
28
# File 'lib/wonkavision/plugins/analytics/persistence/mongo_store.rb', line 26

def[](document_id)
  facts_collection.find({ :_id => document_id}).to_a.pop
end

#aggregations_collectionObject



22
23
24
# File 'lib/wonkavision/plugins/analytics/persistence/mongo_store.rb', line 22

def aggregations_collection
  Wonkavision::Mongo.database[aggregations_collection_name]
end

#aggregations_collection_nameObject



18
19
20
# File 'lib/wonkavision/plugins/analytics/persistence/mongo_store.rb', line 18

def aggregations_collection_name
  "wv.#{owner.name.underscore.gsub("::",".")}.aggregations"
end

#facts_collectionObject



14
15
16
# File 'lib/wonkavision/plugins/analytics/persistence/mongo_store.rb', line 14

def facts_collection
  Wonkavision::Mongo.database[facts_collection_name]
end

#facts_collection_nameObject



10
11
12
# File 'lib/wonkavision/plugins/analytics/persistence/mongo_store.rb', line 10

def facts_collection_name
  "wv.#{owner.name.underscore.gsub("::",".")}.facts"
end