mongocore 0.1.5 → 0.1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongocore/document.rb +2 -2
- data/lib/mongocore/query.rb +5 -7
- data/lib/mongocore.rb +1 -1
- data/mongocore.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6fe535047cb379a759c98be8828bc50080e77f7
|
4
|
+
data.tar.gz: e82f913a97873248c3bc875f86b00fd851b12744
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2113422f03564f7b2dde9bd5c5f68ea5c7589f02b2a84c8dd8396cee47eae9c6dcb59a2d041d30416dd880ec550009092f182bed6842e18d0bdeb89442711c7
|
7
|
+
data.tar.gz: 845d796fafe391b450cf16299b45e362b4292ee04cb5b6d9fc7a5c9afd9c5c37d510f7f7b91d88ea1f3b664cebd1da8b0bed2afcf79ba3712ed8add3553a0b2c
|
data/lib/mongocore/document.rb
CHANGED
data/lib/mongocore/query.rb
CHANGED
@@ -34,11 +34,12 @@ module Mongocore
|
|
34
34
|
|
35
35
|
# Find. Returns a Mongocore::Query
|
36
36
|
def find(q = {}, o = {}, s = {})
|
37
|
-
|
37
|
+
self.class.new(@model, @query.merge(normalize(q)), @options.merge(o), @store.merge(s))
|
38
38
|
end
|
39
39
|
|
40
40
|
# Normalize query
|
41
41
|
def normalize(q)
|
42
|
+
|
42
43
|
# Support find passing an ID
|
43
44
|
q = {:_id => oid(q)} unless q.is_a?(Hash)
|
44
45
|
|
@@ -73,8 +74,7 @@ module Mongocore
|
|
73
74
|
end
|
74
75
|
|
75
76
|
# Count. Returns the number of documents as an integer
|
76
|
-
def count
|
77
|
-
find(*args) if args.any?
|
77
|
+
def count
|
78
78
|
counter || fetch(:count)
|
79
79
|
end
|
80
80
|
|
@@ -85,14 +85,12 @@ module Mongocore
|
|
85
85
|
|
86
86
|
# Return first document
|
87
87
|
def first(*args)
|
88
|
-
find(*args)
|
89
|
-
modelize(fetch(:first))
|
88
|
+
modelize(find(*args).fetch(:first))
|
90
89
|
end
|
91
90
|
|
92
91
|
# Return last document
|
93
92
|
def last(*args)
|
94
|
-
|
95
|
-
sort(:_id => -1).limit(1).first
|
93
|
+
sort(:_id => -1).limit(1).first(*args)
|
96
94
|
end
|
97
95
|
|
98
96
|
# Return all documents
|
data/lib/mongocore.rb
CHANGED
data/mongocore.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'mongocore'
|
3
|
-
s.version = '0.1.5'
|
3
|
+
s.version = '0.1.5.1'
|
4
4
|
s.date = '2017-10-17'
|
5
5
|
s.summary = "MongoDB ORM implementation on top of the Ruby MongoDB driver"
|
6
6
|
s.description = "Does validations, associations, scopes, filters, pagination, counter cache, request cache, and nested queries. Using a YAML schema file, which supports default values, data types, and security levels for each key."
|