mongoose-sort-encrypted-field
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -135,7 +135,7 @@ "use strict"; | ||
const log2n = Math.round(Math.log2(n)) + 1; | ||
let diff = Buffer.from("".padEnd(this.noOfBytesForSortId, "f"), "hex"); | ||
let diff = Buffer.from("".padEnd(2 * this.noOfBytesForSortId, "f"), "hex"); | ||
for (let i = 0; i < log2n; i += 1) { | ||
diff = shift(diff, -1); | ||
} | ||
let curr = Buffer.from("".padEnd(this.noOfBytesForSortId, "0"), "hex"); | ||
let curr = Buffer.from("".padEnd(2 * this.noOfBytesForSortId, "0"), "hex"); | ||
for (let i = 0; i < n; i += 1) { | ||
@@ -142,0 +142,0 @@ if (i === 0 || documents[i - 1][this.fieldName] !== documents[i][this.fieldName]) { |
{ | ||
"name": "mongoose-sort-encrypted-field", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Mongoose plugin to enable sorting on encrypted fields", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -135,15 +135,15 @@ const assert = require("assert"); | ||
}); | ||
// it("Sorting check for { firstName: 1, middleName: 1, lastName: 1 } after rebuilding for all documents", async function () { | ||
// await Promise.all( | ||
// Object.values(modelsQueue.groupIdToSortIdManagerMap).map(async (sortIdManger) => sortIdManger.updateSortIdForAllDocuments()) | ||
// ); | ||
// const unencryptedUsers = await unencryptedUserModel.find({}).sort({ firstName: 1, middleName: 1, lastName: 1 }).exec(); | ||
// const encryptedUsers = await encryptedUserModel.find({}).sort({ firstNameSort: 1, middleNameSort: 1, lastNameSort: 1 }).exec(); | ||
// await Promise.all( | ||
// unencryptedUsers.map(async (unencryptedUser, i) => { | ||
// assert.equal(unencryptedUser.lastName, encryptedUsers[i].lastName); | ||
// }) | ||
// ); | ||
// }); | ||
it("Sorting check for { firstName: 1, middleName: 1, lastName: 1 } after rebuilding for all documents", async function () { | ||
await Promise.all( | ||
Object.values(modelsQueue.groupIdToSortIdManagerMap).map(async (sortIdManger) => sortIdManger.updateSortIdForAllDocuments()) | ||
); | ||
const unencryptedUsers = await unencryptedUserModel.find({}).sort({ firstName: 1, middleName: 1, lastName: 1 }).exec(); | ||
const encryptedUsers = await encryptedUserModel.find({}).sort({ firstNameSort: 1, middleNameSort: 1, lastNameSort: 1 }).exec(); | ||
await Promise.all( | ||
unencryptedUsers.map(async (unencryptedUser, i) => { | ||
assert.equal(unencryptedUser.lastName, encryptedUsers[i].lastName); | ||
}) | ||
); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62977