mongocore 0.3.1.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0d675c271e8b08722c8c8718eff9c47a0a063a2
4
- data.tar.gz: d9d09c93594c0753aebb8828d701af09fae02622
3
+ metadata.gz: 2892cb201bc815741fda85f48d3dcd2b4546dec7
4
+ data.tar.gz: 36cfc6ded9f8b95fc7be644669c298511b2a102e
5
5
  SHA512:
6
- metadata.gz: '038870dd3510025c0542a87bf6772b164b7069647c33f557818640c0eacdf3b9fa76e7b17db1e8edcbff73a68d492b209e737e8f223a767499d3fc47d15ca367'
7
- data.tar.gz: 7a8081b233a7ccd57a614e454246019b5bc68dea029d5b78557d03f2e74614b177d9f98f0d34713ac70a8fb460bc1d34f4c3b7290554a5380301653f7f00b1f2
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
- Mongocore.db = Mongo::Client.new(['127.0.0.1:27017'], :database => "mongocore_#{ENV['RACK_ENV']}")
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.](http://yaml.org) schema file. This is where you define keys, defaults, description, counters, associations, access, tags, scopes and accessors.
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 and to_json
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: to_json(:badge, :campaigns)
340
+ # Multiple tags possible: attributes(:badge, :campaigns)
329
341
  tags:
330
342
  - badge
331
343
  - campaigns
@@ -301,6 +301,7 @@ module Mongocore
301
301
  def insert(a = {}, o = {})
302
302
  new(a).tap{|r| r.save(o)}
303
303
  end
304
+ alias_method :create, :insert
304
305
 
305
306
  # Each
306
307
  def each(&block)
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.3.1.1'
10
+ VERSION = '0.3.2'
11
11
 
12
12
  # # # # # #
13
13
  # Mongocore Ruby Database Driver.
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.1.1'
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."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongocore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fugroup Limited