Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoose-sort-encrypted-field

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-sort-encrypted-field - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

4

lib/sortIdManager.js

@@ -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);
})
);
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc