These are chat archives for Automattic/mongoose

5th
Feb 2016
Sebastien Vaucouleur
@vaucouleur
Feb 05 2016 10:36
The plugin search is down. Is it no longer maintained ? http://plugins.mongoosejs.com/
Konstantin Baierer
@kba
Feb 05 2016 10:52
@vaucouleur something in the heroku deployment broke, a while ago.
@vkarpov15 ?
Konstantin Baierer
@kba
Feb 05 2016 13:00
About the plugin site: Automattic/mongoose#3127
J
@jhyland87
Feb 05 2016 17:03
@vaucouleur I was trying to do whatever it took to be able to reach two levels deep, which this worked :P
Question, if I wanted to create a Mongoose plugin that supported callbacks and promises... what would be the best way to do that?
I think theres a way to do this with Bluebird, which im using, but id like to make this plugin so that anyone can use it, not assuming everyone uses bluebird
And also so people can use it with just callbacks
J
@jhyland87
Feb 05 2016 17:17
Is something like this acceptable?
'use strict'

const Promise = require('bluebird')

function tester(foo, cb){
    return new Promise( ( res, rej ) => {
        const result = 'You said ' + foo
        if( typeof cb === 'function' ){
            cb( null, result )
        }
        else {
            res( result )
        }
    })
}

tester('foo', (err, data) => {
    if( err )
        console.log('ERROR!',err)
    else
        console.log('Result:',data)
})

tester('bar')
    .then( data => {
        console.log('Result:',data)
    })
    .catch( err => {
        console.log('ERROR!',err)
    })
J
@jhyland87
Feb 05 2016 17:51
Nvm, Got it!
J
@jhyland87
Feb 05 2016 18:22
Anyone ever get the error: Cannot read property 'Kerberos' of undefined ??
Super weird.. This is a pretty basic JS file
Def related to Mongoose tho
Its not fatal.. just annoying, lol
Valeri Karpov
@vkarpov15
Feb 05 2016 19:01
@jhyland87 started getting it too. Its something with the underlying driver, I'll check it out. But unless you use kerberos auth (which you probably don't if you get this error) then don't worry about it
@kba yeah the plugins site has been down for a while, haven't had a chance to fix it because my knowledge of heroku is minimal. Strongly considering just getting an ec2 free tier box
antonioaltamura
@antonioaltamura
Feb 05 2016 23:01
guys what's the best module for a file upload schema field? (I need just pdf)