performance fixes

This commit is contained in:
Theodor Diaconu 2017-11-29 11:58:37 +02:00
parent 6974ea17be
commit 7a7a147794
2 changed files with 5 additions and 5 deletions

View file

@ -180,11 +180,13 @@ function snapBackCaches(node) {
// process stuff
_.each(node.snapCaches, (linkName, cacheField) => {
const isSingle = _.contains(node.snapCachesSingles, cacheField);
const linker = node.collection.getLinker(linkName);
// we do this because for one direct and one meta direct, id is not stored
const shoudStoreLinkStorage = !linker.isMany() && !linker.isVirtual();
node.results.forEach(result => {
if (result[cacheField]) {
const linker = node.collection.getLinker(linkName);
if (!linker.isMany() && !linker.isVirtual()) {
if (shoudStoreLinkStorage) {
Object.assign(result[cacheField], {
_id: linker.isMeta()
? result[linker.linkStorageField]._id

View file

@ -41,8 +41,6 @@ describe('Query Link Cache', function () {
assert.isObject(post.author);
assert.isString(post.author._id);
console.log(post.author);
unstubFind(Authors);
// now that we specify an additional field, it should bypass the cache