mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Merge linting error fixes into i18n branch of n-r-n
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013,2014 IBM Corp.
|
||||
* Copyright 2013,2015 IBM Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -87,6 +87,9 @@ module.exports = function(RED) {
|
||||
if (typeof msg.payload !== "object") {
|
||||
msg.payload = {"payload": msg.payload};
|
||||
}
|
||||
if (msg.hasOwnProperty("_id") && !msg.payload.hasOwnProperty("_id")) {
|
||||
msg.payload._id = msg._id;
|
||||
}
|
||||
coll.save(msg.payload,function(err, item) {
|
||||
if (err) {
|
||||
node.error(err,msg);
|
||||
@@ -104,6 +107,9 @@ module.exports = function(RED) {
|
||||
if (typeof msg.payload !== "object") {
|
||||
msg.payload = {"payload": msg.payload};
|
||||
}
|
||||
if (msg.hasOwnProperty("_id") && !msg.payload.hasOwnProperty("_id")) {
|
||||
msg.payload._id = msg._id;
|
||||
}
|
||||
coll.insert(msg.payload, function(err, item) {
|
||||
if (err) {
|
||||
node.error(err,msg);
|
||||
@@ -163,7 +169,6 @@ module.exports = function(RED) {
|
||||
|
||||
if (this.mongoConfig) {
|
||||
var node = this;
|
||||
var selector;
|
||||
MongoClient.connect(this.mongoConfig.url, function(err,db) {
|
||||
if (err) {
|
||||
node.error(err);
|
||||
@@ -182,6 +187,7 @@ module.exports = function(RED) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var selector;
|
||||
if (node.operation === "find") {
|
||||
msg.projection = msg.projection || {};
|
||||
selector = ensureValidSelectorObject(msg.payload);
|
||||
|
Reference in New Issue
Block a user