minimongo 0.1.0 → 0.1.1

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: cdc210b03c6a4909f8beaad790a09d5c45142f11
4
- data.tar.gz: 9aa996f4d3c7e81c04cb66b1265bf4c3474a8c20
3
+ metadata.gz: 02e1ac30350ef0cf05f9bc12318eab9bb0b06d1f
4
+ data.tar.gz: a4f9d261baac3739a37bc2454e3fc2cb0c478fa1
5
5
  SHA512:
6
- metadata.gz: e7015d75709cb37cb50fff0e70f6d68ad70bef56fbfc8f06f604ec275d4623118b65653ccfa83aa55934deb5f47720f139e7329b7435de50b9bfea9d2aa8cdcb
7
- data.tar.gz: af4271a4e4b5b750560ac71fc09bcb37f1ede0ba7eeda3f4b04f8076e3c259a0a135a574c9d737572c3a4ae62ed4bd484d681cf54af7dba5643ae846d74aac72
6
+ metadata.gz: 3ca4363014cd5e3c656dd056162a6f6823478cf8ef829bf772d4ec63de458a7817ebe769a96cc09ab98cdd8a1c0356500610d8bc22febc0fd7350e9737239e76
7
+ data.tar.gz: fefe1ca5e5feafc2e4c115af6bf7c508464c0ba6df5000fcd0a89ef8bd3b7635f6dd22a6207727dcb7558167065a220bab1f174719340fbf9b7cc8b6a65a4fa3
@@ -1,3 +1,7 @@
1
+ **Version 0.1.1** - *2017-02-27*
2
+
3
+ - Added support for string id
4
+
1
5
  **Version 0.1.0** - *2017-01-05*
2
6
 
3
7
  - Fixed gemspec issues
data/README.md CHANGED
@@ -17,7 +17,7 @@ or add to Gemfile.
17
17
  # https://docs.mongodb.com/ruby-driver/master/quick-start
18
18
 
19
19
  # Connect
20
- Minimongo.db = Mongo::Client.new([ '127.0.0.1:27017' ], :database => "minimongo")
20
+ Minimongo.db = Mongo::Client.new([ '127.0.0.1:27017' ], :database => "minimongo_#{ENV['RACK_ENV']}")
21
21
 
22
22
  # Include methods in a class or module
23
23
  include Minimongo::Query
@@ -56,6 +56,10 @@ update(:domains, {:_id => p[:id]}, :name => p[:name], :email => p[:email])
56
56
  # Delete
57
57
  delete(:domains, :_id => p[:id])
58
58
 
59
+ # String as ID
60
+ find(:domains, '586333360aec08e87bd62180')
61
+ first(:domains, '586333360aec08e87bd62180')
62
+
59
63
  # String to Object ID
60
64
  oid('586333360aec08e87bd62180')
61
65
 
@@ -19,7 +19,7 @@ module Minimongo
19
19
  def oid(v = nil); BSON::ObjectId.from_string(v) rescue BSON::ObjectId.new; end
20
20
 
21
21
  # Find, insert, update, delete
22
- [:find, :insert, :update, :delete].each{|m| class_eval %Q{def #{m}(*g); Minimongo.db[g.shift].#{m != :find ? "#{m}_one" : m}(*g); end}}
22
+ [:find, :insert, :update, :delete].each{|m| class_eval %Q{def #{m}(*g); g[1] = {:_id => oid(g[1])} if g[1].is_a?(String); Minimongo.db[g.shift].#{m != :find ? "#{m}_one" : m}(*g); end}}
23
23
 
24
24
  # First, last, count, all
25
25
  def first(*g); find(*g).limit(-1).first; end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'minimongo'
3
- s.version = '0.1.0'
4
- s.date = '2017-01-05'
3
+ s.version = '0.1.1'
4
+ s.date = '2017-02-07'
5
5
  s.summary = "Tiny MongoDB library"
6
6
  s.description = "Helpers that sits right on top of mongodb with a nicer syntax. Only 6 lines of code."
7
7
  s.authors = ["Fugroup Limited"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fugroup Limited
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-05 00:00:00.000000000 Z
11
+ date: 2017-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongo
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  version: '0'
75
75
  requirements: []
76
76
  rubyforge_project:
77
- rubygems_version: 2.5.1
77
+ rubygems_version: 2.6.8
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Tiny MongoDB library