I have an issue with querying my mongoose model and passing an altered object to the next promise chain.
The query does get passed to the next .then
but without my newly assigned spaceTempName.
Any idea how to fix this issue?
// promise - search for workspace ...
var promise = Space.findOne( spaceId ).exec();
promise.then( function ( space ) {
return Stack.findOne( { _id: req.params.id }, function( err , stack ) {
stack.spaceTempName = space.name;
stack.name = 'test';
console.log( stack );
return stack;
});
})
.then( function ( stack ) {
console.log( stack );
})