These are chat archives for Automattic/mongoose

23rd
Apr 2015
Roland N Sharp
@rolandnsharp
Apr 23 2015 02:18
Hi all, I'm trying to update my app with the latest stable version of node and mongoose. node v0.12.0 and mongoose ^4.0.1 . Everything seems to be working except the eventEmitter isn't calling from my mongoose models. Any ideas?
Francesco Nero
@francesconero
Apr 23 2015 06:47
Roland N Sharp
@rolandnsharp
Apr 23 2015 07:40
I've narrowed down the problem. Upgrading from mongoose "~3.8.8" to "^4.0.1" my postSave conditionals no longer work if (this.wasNew) or if (_.contains(changes, 'resolved') || auditException.resolved) { Is this handled differently in mongoose 4?
Maksim
@chetverikov
Apr 23 2015 07:50

@rolandnsharp
:point_up: 23 апреля 2015 г., 10:18

https://github.com/Automattic/mongoose/wiki/4.0-Release-Notes #1351

:point_up: 23 апреля 2015 г., 15:40

Automattic/mongoose#2816 - in 4.0.2 version

Roland N Sharp
@rolandnsharp
Apr 23 2015 07:54
@chetverikov thanks, I can't find anything relating to post('save'), My this context is off, it does not contain my document but this: { domain: null, _events: { save: [Function] }, _maxListeners: 0 }
Maksim
@chetverikov
Apr 23 2015 08:37
@rolandnsharp Automattic/mongoose#2816 - in 4.0.2 version
Cody Scott
@Siecje
Apr 23 2015 15:23
If I want to push a item to a list and add an attribute, is that a good idea?
Cody Scott
@Siecje
Apr 23 2015 15:33
For example a user can be in many companies and a user has a company # when he joins the company.
feargal9
@feargal9
Apr 23 2015 18:34
Hi there. I'm trying to remove the object in 'boardTickits' array as seen in screenshot below. The code I'm using to try and remove it is in the second screenshot but there seems to be something missing as it doesn't work. Any help would be great.
alt
alt
feargal9
@feargal9
Apr 23 2015 20:58
Just thought I'd post an update since I've found a solution to this problem. Instead of having 'baordTickits' as an embedded document, whereby the objects in this array are clones..I changed and just stored the ObjectID. Then I used populate function on an api call to get the details for each object :)
Roland N Sharp
@rolandnsharp
Apr 23 2015 23:16
Thanks @chetverikov , Kind of annoying that this will change in future versions of mongoose. Good to know though.
Roland N Sharp
@rolandnsharp
Apr 23 2015 23:42
Okay, upgrade to mongoose 4 is almost complete but now I'm getting an uncaught error in my app.js. I can't narrow it down with my mocha tests because it seems to be breaking in a different place every time. I have a few hundred automated tests and I can't seem to narrow it down by testing specific feature folders. It only breaks when I run them all together.
This is my stack trace:
error: Uncaught error in app.js , stack=TypeError: Cannot read property 'name' of undefined
        at Server.equals (/Users/roland/Sites/lighthouse-api/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:918:16)
        at State.isPrimary (/Users/roland/Sites/lighthouse-api/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset_state.js:68:39)
        at State.update (/Users/roland/Sites/lighthouse-api/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset_state.js:368:69)
        at /Users/roland/Sites/lighthouse-api/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js:926:27
        at /Users/roland/Sites/lighthouse-api/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:770:13
        at Callbacks.emit (/Users/roland/Sites/lighthouse-api/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:84:3)
        at null.messageHandler (/Users/roland/Sites/lighthouse-api/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:218:23)
        at Socket.<anonymous> (/Users/roland/Sites/lighthouse-api/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:294:20)
        at Socket.emit (events.js:107:17)
        at readableAddChunk (_stream_readable.js:163:16)
        at Socket.Readable.push (_stream_readable.js:126:10)
        at TCP.onread (net.js:529:20)