mirror of
				https://github.com/node-red/node-red-nodes.git
				synced 2025-03-01 10:37:43 +00:00 
			
		
		
		
	Update 66-mongodb.js
Call done when the operation is complete
This commit is contained in:
		@@ -115,6 +115,8 @@ module.exports = function(RED) {
 | 
				
			|||||||
                                coll.save(msg.payload,function(err, item) {
 | 
					                                coll.save(msg.payload,function(err, item) {
 | 
				
			||||||
                                    if (err) {
 | 
					                                    if (err) {
 | 
				
			||||||
                                        node.error(err,msg);
 | 
					                                        node.error(err,msg);
 | 
				
			||||||
 | 
					                                    }else {
 | 
				
			||||||
 | 
					                                        node.done();
 | 
				
			||||||
                                    }
 | 
					                                    }
 | 
				
			||||||
                                });
 | 
					                                });
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
@@ -122,6 +124,8 @@ module.exports = function(RED) {
 | 
				
			|||||||
                                coll.save(msg,function(err, item) {
 | 
					                                coll.save(msg,function(err, item) {
 | 
				
			||||||
                                    if (err) {
 | 
					                                    if (err) {
 | 
				
			||||||
                                        node.error(err,msg);
 | 
					                                        node.error(err,msg);
 | 
				
			||||||
 | 
					                                    }else {
 | 
				
			||||||
 | 
					                                        node.done();
 | 
				
			||||||
                                    }
 | 
					                                    }
 | 
				
			||||||
                                });
 | 
					                                });
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
@@ -137,6 +141,8 @@ module.exports = function(RED) {
 | 
				
			|||||||
                                coll.insert(msg.payload, function(err, item) {
 | 
					                                coll.insert(msg.payload, function(err, item) {
 | 
				
			||||||
                                    if (err) {
 | 
					                                    if (err) {
 | 
				
			||||||
                                        node.error(err,msg);
 | 
					                                        node.error(err,msg);
 | 
				
			||||||
 | 
					                                    }else {
 | 
				
			||||||
 | 
					                                        node.done();
 | 
				
			||||||
                                    }
 | 
					                                    }
 | 
				
			||||||
                                });
 | 
					                                });
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
@@ -144,6 +150,8 @@ module.exports = function(RED) {
 | 
				
			|||||||
                                coll.insert(msg, function(err,item) {
 | 
					                                coll.insert(msg, function(err,item) {
 | 
				
			||||||
                                    if (err) {
 | 
					                                    if (err) {
 | 
				
			||||||
                                        node.error(err,msg);
 | 
					                                        node.error(err,msg);
 | 
				
			||||||
 | 
					                                    }else {
 | 
				
			||||||
 | 
					                                        node.done();
 | 
				
			||||||
                                    }
 | 
					                                    }
 | 
				
			||||||
                                });
 | 
					                                });
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
@@ -164,6 +172,8 @@ module.exports = function(RED) {
 | 
				
			|||||||
                            coll.update(query, payload, options, function(err, item) {
 | 
					                            coll.update(query, payload, options, function(err, item) {
 | 
				
			||||||
                                if (err) {
 | 
					                                if (err) {
 | 
				
			||||||
                                    node.error(err,msg);
 | 
					                                    node.error(err,msg);
 | 
				
			||||||
 | 
					                                }else {
 | 
				
			||||||
 | 
					                                    node.done();
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            });
 | 
					                            });
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
@@ -171,6 +181,8 @@ module.exports = function(RED) {
 | 
				
			|||||||
                            coll.remove(msg.payload, function(err, items) {
 | 
					                            coll.remove(msg.payload, function(err, items) {
 | 
				
			||||||
                                if (err) {
 | 
					                                if (err) {
 | 
				
			||||||
                                    node.error(err,msg);
 | 
					                                    node.error(err,msg);
 | 
				
			||||||
 | 
					                                }else {
 | 
				
			||||||
 | 
					                                    node.done();
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            });
 | 
					                            });
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user