Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

create method seems to be misbehaving without cache :) #2

MaxPresman opened this Issue Feb 24, 2012 · 4 comments


None yet
2 participants

line 320..

    save: (callback) ->
        that = @
        fields = do @fields
        notFields = ['constructor', 'save', 'collection', 'create', 'fields', 'update', 'remove', 'models']
        keys = []
        for field of @
            keys.push field if -1 is notFields.indexOf field
        async.filter keys, (key, nextKey) ->
            if that["validate#{ key.camelize() }"]
                that["validate#{ key.camelize() }"] (valid) ->
                    nextKey not valid
                nextKey false
        , (results) ->
            return callback yes, results if results.length > 0
            Cache.delByTag that.collection, -> ##stuff goes bad at this line
            if fields._id
                that.update callback, yes
                that.create callback, yes

seems to be not working without cache..

DEBUG: TypeError: Cannot call method 'delByTag' of undefined
    at /home/blogy/node_modules/mongorito/lib/mongorito.js:432:20
    at /home/blogy/node_modules/mongorito/node_modules/async/lib/async.js:245:13
    at /home/blogy/node_modules/mongorito/node_modules/async/lib/async.js:105:25
    at /home/blogy/node_modules/mongorito/node_modules/async/lib/async.js:242:17
    at /home/blogy/node_modules/mongorito/lib/mongorito.js:428:16
    at /home/blogy/node_modules/mongorito/node_modules/async/lib/async.js:238:13
    at /home/blogy/node_modules/mongorito/node_modules/async/lib/async.js:97:13
    at Array.forEach (native)
    at /home/blogy/node_modules/mongorito/node_modules/async/lib/async.js:26:24
    at /home/blogy/node_modules/mongorito/node_modules/async/lib/async.js:96:9

commenting out the caching line .. seems to work!


vadimdemedes commented Feb 24, 2012

Yes, missed this. Will be fixed ASAP. Thank you!

looks like a cool package, going to implement it for my node blog, and follow : )


vadimdemedes commented Feb 24, 2012

Thank you! Very happy to hear that!

vadimdemedes added a commit that referenced this issue Feb 26, 2012


vadimdemedes commented Feb 26, 2012

Update pushed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment