mongocore 0.1.6 → 0.1.7
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 +5 -2
- data/lib/mongocore/query.rb +5 -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: ad5f759d0098c30be1771c2f96dc97b16d3f3f3c
         | 
| 4 | 
            +
              data.tar.gz: 2e427d8c0bfbb4e878e592b28caf2fa4ae089fd5
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9cacabc91e2e7a783ee9766e4fd1328c7609c71ff78a76343f96e7bc1dfb73b1e329db3417ca0333edc098acd9d59612916cd59bb261c93bc942653ec9d8eb7a
         | 
| 7 | 
            +
              data.tar.gz: 0b6d23cebdc0a0c9f5d7a4bdea56eaba1819f688782bf72db8c29fd4ce4d5fd202b64c9a1e2675ab9019722e3abc2e72ad963ca7ce885a146c5d26edac790d45
         | 
    
        data/lib/mongocore/document.rb
    CHANGED
    
    | @@ -234,7 +234,7 @@ module Mongocore | |
| 234 234 | 
             
                    return false unless valid? if o[:validate]
         | 
| 235 235 |  | 
| 236 236 | 
             
                    # Create a new query
         | 
| 237 | 
            -
                    filter(type){one.update | 
| 237 | 
            +
                    filter(type){one.send((@saved ? :update : :insert), attributes).ok?}
         | 
| 238 238 | 
             
                  end
         | 
| 239 239 |  | 
| 240 240 | 
             
                end
         | 
| @@ -291,7 +291,10 @@ module Mongocore | |
| 291 291 | 
             
                    find({}, {}, :fields => o)
         | 
| 292 292 | 
             
                  end
         | 
| 293 293 |  | 
| 294 | 
            -
             | 
| 294 | 
            +
                  # Insert
         | 
| 295 | 
            +
                  def insert(a = {}, o = {})
         | 
| 296 | 
            +
                    new(a).tap{|r| r.save(o)}
         | 
| 297 | 
            +
                  end
         | 
| 295 298 | 
             
                  # # # # # # # # #
         | 
| 296 299 | 
             
                  # After, before and validation filters
         | 
| 297 300 | 
             
                  # Pass a method name as symbol or a block
         | 
    
        data/lib/mongocore/query.rb
    CHANGED
    
    | @@ -56,6 +56,11 @@ module Mongocore | |
| 56 56 | 
             
                  @collection.find(@query, @options).projection(@store[:fields]).skip(@store[:skip]).sort(@store[:sort]).limit(@store[:limit])
         | 
| 57 57 | 
             
                end
         | 
| 58 58 |  | 
| 59 | 
            +
                # Insert
         | 
| 60 | 
            +
                def insert(a)
         | 
| 61 | 
            +
                  @collection.insert_one(a.delete_if{|k, v| v.nil?})
         | 
| 62 | 
            +
                end
         | 
| 63 | 
            +
             | 
| 59 64 | 
             
                # Update
         | 
| 60 65 | 
             
                def update(a)
         | 
| 61 66 | 
             
                  # We do $set on non nil, $unset on nil
         | 
    
        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.1. | 
| 3 | 
            +
              s.version     = '0.1.7'
         | 
| 4 4 | 
             
              s.date        = '2017-10-21'
         | 
| 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."
         |