mongocore 0.3.1.1 → 0.3.2
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/CHANGELOG.md +6 -0
- data/README.md +17 -5
- data/lib/mongocore/document.rb +1 -0
- data/lib/mongocore.rb +1 -1
- data/mongocore.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2892cb201bc815741fda85f48d3dcd2b4546dec7
|
4
|
+
data.tar.gz: 36cfc6ded9f8b95fc7be644669c298511b2a102e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d15a8105f04db2f5583badc9c27005bc95b49cbc82897d47694bc6b4555f70ea9a5131dfbde0fe4eae09b86a5bffc046820b4a8e97a279966d976d6b3ebfd5c
|
7
|
+
data.tar.gz: 39a1baeb1e02ced7ef9b9d61d243ac79c362a69447bebe709399e84b0d9e8abab6063eb6b04119633dc92867c60d3c29cca402f98171ff539ba3ed1360b6a12d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
**Version 0.3.2** - *2017-11-25*
|
2
|
+
|
3
|
+
- Alias for insert is create
|
4
|
+
|
5
|
+
|
1
6
|
**Version 0.3.1** - *2017-11-25*
|
2
7
|
|
3
8
|
- Fixed bug where error didn't get reset on validation
|
@@ -5,6 +10,7 @@
|
|
5
10
|
- Added default sort option
|
6
11
|
- Renamed a few internal variables
|
7
12
|
|
13
|
+
|
8
14
|
**Version 0.3.0** - *2017-10-30*
|
9
15
|
|
10
16
|
- Removed support for dependent destroy
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Mongocore Ruby Database Driver
|
2
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.
|
3
3
|
|
4
|
-
The perfect companion for Sinatra or other Rack-based web frameworks.
|
4
|
+
The perfect companion for Rails, Sinatra, Susana or other Rack-based web frameworks.
|
5
5
|
|
6
6
|
### Features
|
7
7
|
With Mongocore you can do:
|
@@ -70,13 +70,25 @@ Mongocore.debug = false
|
|
70
70
|
|
71
71
|
```ruby
|
72
72
|
# Set up connection to database engine
|
73
|
-
|
73
|
+
# Add this code to an initializer or in your environment file
|
74
|
+
Mongocore.db = Mongo::Client.new(['127.0.0.1:27017'], :database => "dbname_#{ENV['RACK_ENV']}")
|
75
|
+
|
76
|
+
# Logging options
|
77
|
+
Mongo::Logger.logger.level = ::Logger::INFO
|
78
|
+
Mongo::Logger.logger.level = ::Logger::FATAL
|
79
|
+
|
80
|
+
# Write to log file instead of terminal
|
81
|
+
Mongo::Logger.logger = ::Logger.new('./log/mongo.log')
|
74
82
|
|
75
83
|
# Create a new document
|
76
84
|
m = Model.new
|
77
85
|
m.duration = 59
|
78
86
|
m.save
|
79
87
|
|
88
|
+
# Insert and save in one line
|
89
|
+
m = Model.insert(:duration => 45, :goal => 55)
|
90
|
+
m = Model.create(params, :validate => true) # Alias
|
91
|
+
|
80
92
|
# Create another document
|
81
93
|
p = Parent.new(:house => 'Nice')
|
82
94
|
p.save
|
@@ -226,7 +238,7 @@ Mongocore.db[:models].indexes.create_one({:key => 1}, :unique => true)
|
|
226
238
|
```
|
227
239
|
|
228
240
|
### Schema and models
|
229
|
-
Each model defined using a [YAML
|
241
|
+
Each model is defined using a [YAML](http://yaml.org) schema file. This is where you define keys, defaults, description, counters, associations, access, tags, scopes and accessors.
|
230
242
|
|
231
243
|
The default schema file location is `APP_ROOT/config/db/schema/*.yml`, so if you have a model called Parent, create a yml file called parent.yml.
|
232
244
|
|
@@ -315,7 +327,7 @@ keys:
|
|
315
327
|
default: 60
|
316
328
|
read: dev
|
317
329
|
write: user
|
318
|
-
# Add tags for keys for use with attributes
|
330
|
+
# Add tags for keys for use with attributes
|
319
331
|
tags:
|
320
332
|
- badge
|
321
333
|
|
@@ -325,7 +337,7 @@ keys:
|
|
325
337
|
type: time
|
326
338
|
read: all
|
327
339
|
write: dev
|
328
|
-
# Multiple tags possible:
|
340
|
+
# Multiple tags possible: attributes(:badge, :campaigns)
|
329
341
|
tags:
|
330
342
|
- badge
|
331
343
|
- campaigns
|
data/lib/mongocore/document.rb
CHANGED
data/lib/mongocore.rb
CHANGED
data/mongocore.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'mongocore'
|
3
|
-
s.version = '0.3.
|
3
|
+
s.version = '0.3.2'
|
4
4
|
s.date = '2017-11-25'
|
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."
|