|
|
@ -16,10 +16,9 @@ module.exports = function (db, module) {
|
|
|
|
if (!key || !data) {
|
|
|
|
if (!key || !data) {
|
|
|
|
return callback();
|
|
|
|
return callback();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (data.hasOwnProperty('')) {
|
|
|
|
|
|
|
|
delete data[''];
|
|
|
|
const writeData = helpers.serializeData(data);
|
|
|
|
}
|
|
|
|
db.collection('objects').updateOne({ _key: key }, { $set: writeData }, { upsert: true, w: 1 }, function (err) {
|
|
|
|
db.collection('objects').updateOne({ _key: key }, { $set: data }, { upsert: true, w: 1 }, function (err) {
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
return callback(err);
|
|
|
|
return callback(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -34,7 +33,6 @@ module.exports = function (db, module) {
|
|
|
|
return callback();
|
|
|
|
return callback();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var data = {};
|
|
|
|
var data = {};
|
|
|
|
field = helpers.fieldToString(field);
|
|
|
|
|
|
|
|
data[field] = value;
|
|
|
|
data[field] = value;
|
|
|
|
module.setObject(key, data, callback);
|
|
|
|
module.setObject(key, data, callback);
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -76,7 +74,7 @@ module.exports = function (db, module) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
return callback(err);
|
|
|
|
return callback(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
data = data.map(helpers.deserializeData);
|
|
|
|
var map = helpers.toMap(data);
|
|
|
|
var map = helpers.toMap(data);
|
|
|
|
unCachedKeys.forEach(function (key) {
|
|
|
|
unCachedKeys.forEach(function (key) {
|
|
|
|
cachedData[key] = map[key] || null;
|
|
|
|
cachedData[key] = map[key] || null;
|
|
|
|