These are chat archives for Automattic/mongoose

Feb 2016
Feb 12 2016 03:12
@kba @vkarpov15 Thats what I thought, and thats what im having an issue with... Im trying to see how I should split up the static methods and instance methods. if I try to do something like this, jsdoc doesnt read the functions at all.. hm
I know I could create a folder for each model, then a file to export the statics, and a file to export the instance methods, both within the models folder.. but that would be a huge pita
Konstantin Baierer
Feb 12 2016 09:17

@jhyland87 Just guessing here, but probably Jsdoc expects functions to be named, i.e.

 * foo all the bars
 * @param {string} bar
function foo(bar) { ... }

and then assign them = foo;
Feb 12 2016 11:46
info for the community: VERY useful module for the schema inheritance !
Feb 12 2016 14:56
@kba Yeah, you're right, it has to be function foo(){} or = function(){}. Your way would be ok, except that some of my static and instance methods have the same name, lol
@kba Heres an example, you can see lines 403 and 642
Im also trying to find an automatic way to load them in, so I wouldnt have to do the = foo for every single method I create
Jason Cust
Feb 12 2016 17:49
I think I found a bug with projections on the new subschema (not in a doc array). Has this been reported yet? I can’t find any mention of it on github.
The bug is the entire subdoc is returned regardless of the projection value.
I’ve been able to reproduce on a simple mockup (using 4.3.6). With the subschema it returns the entire subdoc, without the subschema only the selected sub doc fields are returned.
Feb 12 2016 21:11
Hey, what do you guys when unit testing Mongoose models? Im trying mongoose-mock, but i cant seem to get it working (
Wondering if theres something else
My error is:
Failed tests:

  1) Partition .createPartition creates a new partition:

      Partition.createPartition is not a function

      at /Users/asdf/PhpstormProjects/Project/beta-1.0/project-core/test/unit/model/Partition.js:73:34
      at Immediate._onImmediate (/usr/local/Cellar/node/0.12.4/lib/node_modules/lab/lib/runner.js:467:17)
      at processImmediate [as _immediateCallback] (timers.js:384:17)
And Partition.createPartition is most definitely a static method
Ill try mockgoose
Feb 12 2016 21:32
Hm, trying Mockgoose now, and it doesnt throw any errors, but it should be failing the test.. (here)
I noticed it seemed to be passing a little too often, so I changed something that should fail the method, and it passes..