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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 744f17825ab911d65f52d3503143554f866089b5
4
- data.tar.gz: 99df9b5cf77a9b570314431bc886aff2ffca5337
3
+ metadata.gz: c6fe535047cb379a759c98be8828bc50080e77f7
4
+ data.tar.gz: e82f913a97873248c3bc875f86b00fd851b12744
5
5
  SHA512:
6
- metadata.gz: 51caf8f60dc78e033522e98d5f38ab0898fcd9924360ace6c2820ae513bb04f43bd519de7e680043eb24fbe2fe29e7b06a646f78de49dcc7d738adf739bb8e9d
7
- data.tar.gz: '08f518db3a2d63ddcd4bfe528522309ea47e5379a7e61e371f01cda89ea2850551abba6fb877773e78deaecc9ecd041417e64eba1f2d8d00999c653110d6bc32'
6
+ metadata.gz: e2113422f03564f7b2dde9bd5c5f68ea5c7589f02b2a84c8dd8396cee47eae9c6dcb59a2d041d30416dd880ec550009092f182bed6842e18d0bdeb89442711c7
7
+ data.tar.gz: 845d796fafe391b450cf16299b45e362b4292ee04cb5b6d9fc7a5c9afd9c5c37d510f7f7b91d88ea1f3b664cebd1da8b0bed2afcf79ba3712ed8add3553a0b2c
@@ -260,8 +260,8 @@ module Mongocore
260
260
  end
261
261
 
262
262
  # Last
263
- def last
264
- sort(:_id => -1).limit(1).first
263
+ def last(*args)
264
+ sort(:_id => -1).limit(1).first(*args)
265
265
  end
266
266
 
267
267
  # All
@@ -34,11 +34,12 @@ module Mongocore
34
34
 
35
35
  # Find. Returns a Mongocore::Query
36
36
  def find(q = {}, o = {}, s = {})
37
- Mongocore::Query.new(@model, @query.merge(normalize(q)), @options.merge(o), @store.merge(s))
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(*args)
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) if args.any?
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
- find(*args) if args.any?
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
@@ -7,7 +7,7 @@ require 'mongo'
7
7
  require 'request_store'
8
8
 
9
9
  module Mongocore
10
- VERSION = '0.1.5'
10
+ VERSION = '0.1.5.1'
11
11
 
12
12
  # # # # # #
13
13
  # Mongocore Ruby Database Driver.
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."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongocore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fugroup Limited