- Modified privacywrite query with graphLookup:

$graphLookup: {
        from: "projects",
        startWith: "$id_main_project",
        connectFromField: "id_main_project",
        connectToField: "_id",
        as: "ris",
        restrictSearchWithMatch: { $or: [{ privacyread: server_constants.Privacy.all }, { userId: userId }] }
      }
    },
    { $match: { "ris.privacyread": { $exists: true } } },
This commit is contained in:
Paolo Arena
2019-04-13 03:04:49 +02:00
parent 1deba2a5ff
commit 6a0b7db73c
6 changed files with 94 additions and 32 deletions

View File

@@ -215,19 +215,25 @@ module.exports = {
// console.log('currentId', currentId);
sortedList.push(item);
} else {
map.set(item.id_prev, i);
map.set(String(item.id_prev), i);
}
}
while (sortedList.length < linkedList.length) {
// get the item with a previous item ID referencing the current item
var nextItem = linkedList[map.get(currentId)];
if (nextItem === undefined)
if (nextItem === undefined) {
break;
}
sortedList.push(nextItem);
currentId = String(nextItem._id);
}
if (sortedList.length < linkedList.length) {
console.log('ATTENZIONE !!! ', sortedList.length, linkedList.length);
}
// console.log('DOPO sortedList', sortedList);
return sortedList;

View File

@@ -15,7 +15,7 @@ module.exports = Object.freeze({
LIST_END: '10000000',
LIST_START: '0',
LIST_START: null,
Privacy: {
all: 'all',