I have this code in my model:
ContentSchema.post( 'remove', function( item ) {
index.deleteObject( item._id )
})
Here's what's in my controller:
Content.find( { user: user, _id: contentId } )
.remove( function ( err, count ) {
if ( err || count == 0 ) reject( new Error( "There was an error deleting that content from the stream." ) )
resolve( "Item removed from stream" )
})
I expect that when the function in the controller runs, the function in the model should happen. I can see in the debugger it does not fire at all.
I'm using "mongoose": "3.8.23"
and "mongoose-q": "0.0.16"
.