These are chat archives for LearnBoost/mongoose

23rd
Feb 2015
Valeri Karpov
@vkarpov15
Feb 23 2015 03:42
@rubencosta try using mongoose.set('debug', true); and see what the actual query getting sent to MongoDB is - that will help narrow it down
@srajbr why is your query a string? You should pass a JavaScript object to find(), like Products.find({ $and: [/*...*/] });
@kilianc what type is foo in your example?
Ruben Costa
@rubencosta
Feb 23 2015 11:43
@vkarpov15 Thank you, this:
Word.find({$and:[{text: new RegExp('^l')}, {text:{$nin: ['love']}}]}, 'text alias').sort({timesDefined:-1}).limit(5).exec(queryCallback);
is now giving me the expected results. =)
Samiran Raj Boro
@srajbr
Feb 23 2015 12:38
@vkarpov15 I did tried with objects and latter tried with string, both gives the same result
Matt Ma
@mattma
Feb 23 2015 16:34
@vkarpov15 Does Mongoose 4.0.0-rc2 work with Mongo 3.0 WiredTiger storageEngine? Thanks
Riyadh Al Nur
@riyadhalnur
Feb 23 2015 18:22
is it possible to decorate virtual methods?
i have 2 virtual methods doing the same thing
wondering if i could decorate it to reduce redundant code
Valeri Karpov
@vkarpov15
Feb 23 2015 20:32
@mattma it should.
@riyadhalnur decorate in what way? Not sure what you mean
@srajbr can you show me a couple of your documents? Would make it easier for me to reproduce
Riyadh Al Nur
@riyadhalnur
Feb 23 2015 20:39
@vkarpov15 the get and set method for a virtual has the same code
just different names
something in the line of this
so i was thinking of decorating a function which runs the function in question but assigns different variables depending on the type of virtual where 'settings' and 'preferences' are the virtuals here
This message was deleted
function compose (fn1, fn2) {
  return function compose_ (something) {
    return fn1.call(this, fn2.call(this, something));
  }
}