Merge branch 'develop' into feature-nested-sets
This commit is contained in:
@@ -19,6 +19,12 @@ export default function writeScope(creatureId, computation) {
|
||||
// Mongo can't handle keys that start with a dollar sign
|
||||
if (key[0] === '$' || key[0] === '_') continue;
|
||||
|
||||
// Remove empty objects
|
||||
if (Object.keys(scope[key]).length === 0) {
|
||||
delete scope[key];
|
||||
continue;
|
||||
}
|
||||
|
||||
// Remove large properties that aren't likely to be accessed
|
||||
delete scope[key].parent;
|
||||
|
||||
@@ -29,6 +35,11 @@ export default function writeScope(creatureId, computation) {
|
||||
}
|
||||
}
|
||||
|
||||
// If this is a creature property, replace the property with a link
|
||||
if (scope[key]._id && scope[key].type) {
|
||||
scope[key] = { _propId: scope[key]._id };
|
||||
}
|
||||
|
||||
// Only update changed fields
|
||||
if (!EJSON.equals(variables[key], scope[key])) {
|
||||
if (!$set) $set = {};
|
||||
|
||||
Reference in New Issue
Block a user