mongocore 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/lib/mongocore/schema.rb +11 -0
- data/lib/mongocore.rb +1 -1
- data/mongocore.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f423817d911435069c35d9df2d045fdbe92db2ed
|
4
|
+
data.tar.gz: b621452a8e46757909ff4d890abc1a2fd7dedff0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcbc8a4d12142eb73d1bf88e915b985df87322ff2fbbe888ec8783eb1750e876ece02507fd8dd139adf67220bb4f5994adec4d63cb547b1c55b6c865b4529ac0
|
7
|
+
data.tar.gz: d1d4c3fb4080dd226d37e91a220866f0aba13734fcf020f2a8c98ad5557a685c6c7795e9ccb9c049397271b6fa747536c106c2030d1448b3896c2a8284bae0f0
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Mongocore Ruby Database Driver
|
2
|
-
A new MongoDB ORM implementation on top of the [MongoDB Ruby driver.](https://docs.mongodb.com/ruby-driver/master/quick-start/) Very fast and light weight.
|
2
|
+
A new MongoDB ORM implementation on top of the [latest MongoDB Ruby driver.](https://docs.mongodb.com/ruby-driver/master/quick-start/) Very fast and light weight.
|
3
3
|
|
4
4
|
The perfect companion for Rails, Sinatra, Susana or other Rack-based web frameworks.
|
5
5
|
|
@@ -21,7 +21,7 @@ Please read [the source code](https://github.com/fugroup/mongocore/tree/master/l
|
|
21
21
|
| -------------------------------------- | ----- | ------- | ------------- |
|
22
22
|
| [Mongoid](http://mongoid.com) | 256 | 14371 | 10590 |
|
23
23
|
| [MongoMapper](http://mongomapper.com) | 91 | 200 | 4070 |
|
24
|
-
| [Mongocore](http://mongocore.com) | 8 |
|
24
|
+
| [Mongocore](http://mongocore.com) | 8 | 269 | 483 |
|
25
25
|
|
26
26
|
<br>
|
27
27
|
|
@@ -124,6 +124,8 @@ Model.each do |m|
|
|
124
124
|
puts m
|
125
125
|
end
|
126
126
|
|
127
|
+
# each_with_index, each_with_object and map works as well
|
128
|
+
|
127
129
|
# Works with finds, scopes and associations
|
128
130
|
Model.find(:duration => 50).each{|m| puts m}
|
129
131
|
|
@@ -263,7 +265,7 @@ keys:
|
|
263
265
|
# @desc: Describes the key, can be used for documentation.
|
264
266
|
# @type: object_id, string, integer, float, boolean, time, hash, array
|
265
267
|
# @default: the default value for the key when you call .new
|
266
|
-
# @read: access level for read: all, user, dev, admin, super, app
|
268
|
+
# @read: access level for read: all, user, owner, dev, admin, super, app
|
267
269
|
# @write: access level for write. Returns nil if no access, as on read
|
268
270
|
|
269
271
|
# Object ID, usually added for each model
|
data/lib/mongocore/schema.rb
CHANGED
@@ -43,12 +43,23 @@ module Mongocore
|
|
43
43
|
(tags[0] ? @keys.select{|k, v| v[:tags] & tags} : @keys).keys
|
44
44
|
end
|
45
45
|
|
46
|
+
# Get time
|
47
|
+
def time(val)
|
48
|
+
case val
|
49
|
+
when Date then val.to_time.utc
|
50
|
+
when String then Time.parse(val).utc
|
51
|
+
when Time then val.utc
|
52
|
+
else nil
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
46
56
|
# Convert type if val and schema type is set
|
47
57
|
def convert(key, val)
|
48
58
|
return nil if val.nil?
|
49
59
|
case type(key)
|
50
60
|
when :string then val.to_s
|
51
61
|
when :integer then val.to_i
|
62
|
+
when :time then time(val)
|
52
63
|
when :float then val.to_f
|
53
64
|
when :boolean then val.to_s.to_bool
|
54
65
|
when :object_id then oid(val)
|
data/lib/mongocore.rb
CHANGED
data/mongocore.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'mongocore'
|
3
|
-
s.version = '0.4.
|
4
|
-
s.date = '
|
3
|
+
s.version = '0.4.1'
|
4
|
+
s.date = '2018-01-10'
|
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.4.
|
4
|
+
version: 0.4.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:
|
11
|
+
date: 2018-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongo
|