mongocore 0.1.5.2 → 0.1.5.3
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 +4 -4
- data/lib/mongocore/document.rb +7 -12
- data/lib/mongocore/query.rb +0 -2
- data/lib/mongocore/schema.rb +0 -1
- data/lib/mongocore.rb +1 -2
- data/mongocore.gemspec +2 -2
- metadata +2 -3
- data/lib/mongocore/errors.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c244545f62fec979cdb7c7040f405ddbe99cc76e
|
4
|
+
data.tar.gz: fb4f8f451c2231baac447819f34d3b0491b38421
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c80c0b596e67f028244c6744fdb6188bb8a6c1d71a9e3d7c35b67517431e1c36b26e39a70ec26ea664ec71c3956e675a571e14d3ae06f3828533c72611ca11dc
|
7
|
+
data.tar.gz: 27ec9db00a4648be973a0cebdb154155a7fedb2ea32ba225e830b1465e00a9cfd749a3e986e4f4671d1f84155f943ba917c2f98a532b044392d51cb96bdac062
|
data/lib/mongocore/document.rb
CHANGED
@@ -43,26 +43,21 @@ module Mongocore
|
|
43
43
|
|
44
44
|
attr_accessor :errors, :changes, :saved
|
45
45
|
|
46
|
-
|
47
46
|
# # # # # # # # # # #
|
48
47
|
# The class initializer, called when you write Model.new
|
49
48
|
# Pass in attributes you want to set: Model.new(:duration => 60)
|
50
49
|
# Defaults are filled in automatically.
|
51
50
|
#
|
52
51
|
def initialize(a = {})
|
53
|
-
a = a.deep_symbolize_keys
|
54
|
-
|
55
|
-
# The _id has the BSON object, create new unless it exists
|
56
|
-
a[:_id] ? @saved = true : a[:_id] = BSON::ObjectId.new
|
57
|
-
|
58
|
-
# The errors hash
|
59
|
-
@errors = Mongocore::Errors.new{|h, k| h[k] = []}
|
60
52
|
|
61
53
|
# Defaults
|
62
|
-
self.class.schema.defaults.
|
54
|
+
self.attributes = self.class.schema.defaults.merge(a)
|
55
|
+
|
56
|
+
# The _id is a BSON object, create new unless it exists
|
57
|
+
@_id ? @saved = true : @_id = BSON::ObjectId.new
|
63
58
|
|
64
|
-
#
|
65
|
-
|
59
|
+
# The errors hash
|
60
|
+
@errors = Hash.new{|h, k| h[k] = []}
|
66
61
|
|
67
62
|
# The changes hash
|
68
63
|
@changes = Hash.new{|h, k| h[k] = []}
|
@@ -86,7 +81,7 @@ module Mongocore
|
|
86
81
|
|
87
82
|
# Update document in db
|
88
83
|
def update(a = {})
|
89
|
-
|
84
|
+
self.attributes = a; filter(:update){single.update(a).ok?}
|
90
85
|
end
|
91
86
|
|
92
87
|
# Delete a document in db
|
data/lib/mongocore/query.rb
CHANGED
@@ -39,7 +39,6 @@ module Mongocore
|
|
39
39
|
|
40
40
|
# Normalize query
|
41
41
|
def normalize(q)
|
42
|
-
|
43
42
|
# Support find passing an ID
|
44
43
|
q = {:_id => oid(q)} unless q.is_a?(Hash)
|
45
44
|
|
@@ -105,7 +104,6 @@ module Mongocore
|
|
105
104
|
|
106
105
|
# Paginate
|
107
106
|
def paginate(o = {})
|
108
|
-
|
109
107
|
# Get total count before applying pagination
|
110
108
|
total = fetch(:count)
|
111
109
|
|
data/lib/mongocore/schema.rb
CHANGED
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.3'
|
11
11
|
|
12
12
|
# # # # # #
|
13
13
|
# Mongocore Ruby Database Driver.
|
@@ -38,7 +38,6 @@ module Mongocore
|
|
38
38
|
end
|
39
39
|
|
40
40
|
require_relative 'mongocore/ext'
|
41
|
-
require_relative 'mongocore/errors'
|
42
41
|
require_relative 'mongocore/document'
|
43
42
|
require_relative 'mongocore/query'
|
44
43
|
require_relative 'mongocore/schema'
|
data/mongocore.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'mongocore'
|
3
|
-
s.version = '0.1.5.
|
4
|
-
s.date = '2017-10-
|
3
|
+
s.version = '0.1.5.3'
|
4
|
+
s.date = '2017-10-18'
|
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."
|
7
7
|
s.authors = ["Fugroup Limited"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.3
|
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-10-
|
11
|
+
date: 2017-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongo
|
@@ -86,7 +86,6 @@ files:
|
|
86
86
|
- lib/mongocore/access.rb
|
87
87
|
- lib/mongocore/cache.rb
|
88
88
|
- lib/mongocore/document.rb
|
89
|
-
- lib/mongocore/errors.rb
|
90
89
|
- lib/mongocore/ext.rb
|
91
90
|
- lib/mongocore/filters.rb
|
92
91
|
- lib/mongocore/query.rb
|