Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongoose callback in save function

documentFoo.save(function(err, documentFoo, [isSaveSuccessful]){
    if(err){ return next(err); }

    if (isSaveSuccessful === 1){

        // documentFoo has been saved correctly 
        // do stuff with the saved documentFoo
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mongoose #callback #save #function
ADD COMMENT
Topic
Name
6+5 =