mongoose icon indicating copy to clipboard operation
mongoose copied to clipboard

Object #<Object> has not method 'setMaxListeners'

Open matteontw opened this issue 15 years ago • 8 comments

I'm experiencing this issue:

node version: 0.4.12 mongoose version: 2.3.0

node.js:134 throw e;

TypeError: Object # has not method 'setMaxListeners'

at Document (/usr/local/lib/node_modules/mongoose/lib/document.js:29:8) at Model (/usr/local/lib/node_modules/mongoose/lib/model.js:25:12)

if it could be useful I'm trying to use node-heatmap (https://github.com/substack/node-heatmap) within a find response to create a new heat map.

probably I suppose it's a sort of incompatibly between these two models

matteontw avatar Oct 04 '11 22:10 matteontw

interesting. is node-heatmap the only other lib you are using? does this error occur when you do not include node-heatmap?

aheckmann avatar Oct 05 '11 02:10 aheckmann

nope there are some other modules loaded, but unused in that function.

btw I decided to make a little test with only these few modules:

  • mongoose
  • express
  • sys
  • fs
  • util
  • heatmap

and it still crash with the same issue.

I tried also to have only:

  • mongoose
  • heatmap

and it still fails on heatmap() function with the error above on mongoose libs

matteontw avatar Oct 05 '11 19:10 matteontw

i can't reproduce this. heatmap and mongoose are working fine together for me. any other ideas?

aheckmann avatar Oct 14 '11 15:10 aheckmann

I suffered this recently. found I needed to be sure to be creating a new model object when saving...

justinTNT avatar Oct 16 '11 03:10 justinTNT

I'm having the same issue and here's my code.

https://gist.github.com/1294757

pennyfx avatar Oct 18 '11 06:10 pennyfx

@pennyfx - Thanks for the gist, I am now able to reproduce (finally). Looking into it

aheckmann avatar Oct 18 '11 14:10 aheckmann

got it, take a look at the gist posted by @pennyfx. You'll see on line 27 var Post = mongoose.Model('Post');.

This should instead be var Post = mongoose.model('Post');.

Note the capitalization of model.

aheckmann avatar Oct 18 '11 14:10 aheckmann

Woot, thanks!

jcldavid avatar Feb 25 '13 04:02 jcldavid