Merge linting error fixes into i18n branch of n-r-n

This commit is contained in:
dceejay
2015-06-16 14:38:36 +01:00
parent da209a6b66
commit ba0e2c3796
9 changed files with 73 additions and 85 deletions

View File

@@ -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);