minimongo 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +5 -1
- data/lib/minimongo/query.rb +1 -1
- data/minimongo.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02e1ac30350ef0cf05f9bc12318eab9bb0b06d1f
|
4
|
+
data.tar.gz: a4f9d261baac3739a37bc2454e3fc2cb0c478fa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ca4363014cd5e3c656dd056162a6f6823478cf8ef829bf772d4ec63de458a7817ebe769a96cc09ab98cdd8a1c0356500610d8bc22febc0fd7350e9737239e76
|
7
|
+
data.tar.gz: fefe1ca5e5feafc2e4c115af6bf7c508464c0ba6df5000fcd0a89ef8bd3b7635f6dd22a6207727dcb7558167065a220bab1f174719340fbf9b7cc8b6a65a4fa3
|
data/CHANGELOG.md
CHANGED
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 => "
|
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
|
|
data/lib/minimongo/query.rb
CHANGED
@@ -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
|
data/minimongo.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'minimongo'
|
3
|
-
s.version = '0.1.
|
4
|
-
s.date = '2017-
|
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.
|
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-
|
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.
|
77
|
+
rubygems_version: 2.6.8
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
80
|
summary: Tiny MongoDB library
|