diff --git a/api/src/controllers/collection-controller.js b/api/src/controllers/collection-controller.js index e0e1c5939..48701cd67 100644 --- a/api/src/controllers/collection-controller.js +++ b/api/src/controllers/collection-controller.js @@ -102,7 +102,7 @@ const updateCollection = async function(incomingObj, collectionId, displayName) let arrayOfObjIds = []; for(const record of incomingObj.records){ - if(recordIds.includes(record)){ + if(!recordIds.includes(record)){ recordsToAdd.push(record); arrayOfObjIds.push(new ObjectId(record)); } diff --git a/api/test/factories/factory_helper.js b/api/test/factories/factory_helper.js index 93aabf5dd..cfc50eb31 100644 --- a/api/test/factories/factory_helper.js +++ b/api/test/factories/factory_helper.js @@ -156,7 +156,7 @@ function hexaDecimal(count) { function generateSeededObjectId(value) { let oid = (typeof value === "undefined") ? hexaDecimal(24).toLocaleLowerCase() : value; - if (!bsonObjectId.isValid(oid)) throw new Error("Invalid attempt to generate an ObjectID: '" + oid + "'"); + if (!bsonObjectId.isValid(oid)) throw new Error(`Invalid attempt to generate an ObjectID: ${oid}`); return mongTypes.ObjectId(oid); }