entity_store 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/entity_store/event.rb +1 -1
- data/lib/entity_store/mongo_entity_store.rb +20 -9
- data/lib/entity_store/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e43b6eb661aca44b6787f609047b1d26a8f7ce35
|
4
|
+
data.tar.gz: 1539522bfe305d04047a248b2b9fce12847fe163
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46d856ef7e4ca152fe3859da3563ac5f33f15fca7805d42b86b4c3e2536ee4dcd1df1c6779b19c13daeea7983d2b62c31d2e9538c7adbe0e90436d6dec0345ee
|
7
|
+
data.tar.gz: 6de4e6ae68378f4f3e4083fd7723ff1447722afe2f36fb377f5a4cdb5d9d6281457c08a2000868a1b2c886d1c0f1bedb2753a18100df7e9d20f62dbd31100e66
|
data/lib/entity_store/event.rb
CHANGED
@@ -161,19 +161,30 @@ module EntityStore
|
|
161
161
|
|
162
162
|
query = { '$or' => query_items }
|
163
163
|
|
164
|
-
options = {
|
165
|
-
:sort => [['entity_version', Mongo::ASCENDING], ['_id', Mongo::ASCENDING]]
|
166
|
-
}
|
167
|
-
|
168
164
|
result = Hash[ criteria.map { |item| [ item[:id], [] ] } ]
|
169
165
|
|
170
|
-
events.find(query
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
166
|
+
events.find(query).each do |attrs|
|
167
|
+
result[attrs['_entity_id'].to_s] << attrs
|
168
|
+
end
|
169
|
+
|
170
|
+
result.each do |id, events|
|
171
|
+
# Have to do the sort client side as otherwise the query will not use
|
172
|
+
# indexes (http://docs.mongodb.org/manual/reference/operator/query/or/#or-and-sort-operations)
|
173
|
+
events.sort_by! { |attrs| [attrs['entity_version'], attrs['_id']] }
|
174
|
+
|
175
|
+
# Convert the attributes into event objects
|
176
|
+
events.map! do |attrs|
|
177
|
+
begin
|
178
|
+
EntityStore::Config.load_type(attrs['_type']).new(attrs)
|
179
|
+
rescue => e
|
180
|
+
log_error "Error loading type #{attrs['_type']}", e
|
181
|
+
nil
|
182
|
+
end
|
175
183
|
end
|
184
|
+
|
185
|
+
events.compact!
|
176
186
|
end
|
187
|
+
|
177
188
|
result
|
178
189
|
end
|
179
190
|
end
|
data/lib/entity_store/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: entity_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Bird
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongo
|