easymongo 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7a9dd9ec2c1e02958a6dea51c016098503339f1
4
- data.tar.gz: 8256ef14714ce68534054e91cfce80ee325d5d37
3
+ metadata.gz: cba05d54e026c7b45fb75333246960f67e9b69b8
4
+ data.tar.gz: 15dc3132d2094ca2d100906aebcdc6e40fab3cfe
5
5
  SHA512:
6
- metadata.gz: bafd27e6d32f98977fbf35de10c78199c2af622b0130d5c4165cd292419dfd5438aacad180b92d5ed5f2975d6ed2ab5a4dfd247b5cd26b348cdf30ae0dc10b8f
7
- data.tar.gz: 51d756276a046a0a0c480b12bdbb9cc5f6516135c92698e28455dd2372b97fbaae792e7be2625bb2a4bb9a47b21454a45dfc96e6d91ac8224bebe5e9d5461e12
6
+ metadata.gz: 898a6fdd306de4580a85eb94a988f3d9461a4745bf365df63339a61f91a9f1fec17c2f6456b1a25f067d88ce6d0393d2e67cf26a4b9d8bc35470dec35fba2979
7
+ data.tar.gz: e95bbe7722137580f8b179ae0a4902919bbe43d29de27aa01d308ef4e8fc6942cc7006b7ca51e1efd7cf51529c9250096cd60384b861bf6029b5b9bb07b84c84
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ **Version 0.0.5** - *2017-07-16*
2
+
3
+ - Added projection and skip
4
+
5
+
1
6
  **Version 0.0.4** - *2017-07-13*
2
7
 
3
8
  - Simplified result
data/easymongo.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'easymongo'
3
- s.version = '0.0.4'
3
+ s.version = '0.0.5'
4
4
  s.date = '2017-07-13'
5
5
  s.summary = "Super Easy MongoDB client"
6
6
  s.description = "The way MongoDB for Ruby should be, can't get easier than this"
@@ -14,7 +14,6 @@ module Easymongo
14
14
 
15
15
  # Write variables
16
16
  doc.each{|k, v| attr(k, v)}
17
-
18
17
  end
19
18
 
20
19
  # Get bson id
@@ -56,6 +56,16 @@ module Easymongo
56
56
  g!(d); s[:cursor] = cursor.limit(n.to_i); self
57
57
  end
58
58
 
59
+ # Skip
60
+ def skip(n, d = {})
61
+ g!(d); s[:cursor] = cursor.skip(n.to_i); self
62
+ end
63
+
64
+ # Fields
65
+ def fields(data, d = {})
66
+ g!(d); s[:cursor] = cursor.projection(data); self
67
+ end
68
+
59
69
  # Sort
60
70
  def sort(data, d = {})
61
71
  g!(d); s[:cursor] = cursor.sort(data); self
@@ -98,10 +108,10 @@ module Easymongo
98
108
  def ids(data)
99
109
 
100
110
  # Just return if nothing to do
101
- return data if data.empty?
111
+ return data if data and data.empty?
102
112
 
103
113
  # Support passing id as string
104
- data = {'_id' => data} if data.is_a?(String)
114
+ data = {'_id' => data} if !data or data.is_a?(String)
105
115
 
106
116
  # Turn all keys to string
107
117
  data = data.stringify_keys
data/lib/easymongo.rb CHANGED
@@ -6,9 +6,8 @@ module Easymongo
6
6
  # @homepage: https://github.com/fugroup/easymongo
7
7
  # @author: Vidar <vidar@fugroup.net>, Fugroup Ltd.
8
8
  # @license: MIT, contributions are welcome.
9
- # # # # # #
10
9
 
11
- class << self; attr_accessor :db; end
10
+ class << self; attr_accessor :schema; end
12
11
  end
13
12
 
14
13
  require_relative 'easymongo/document'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easymongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fugroup Limited