New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mongoose-slug-updater

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-slug-updater - npm Package Compare versions

Comparing version 3.2.3 to 3.3.0

.nyc_output/19e80db7-1067-4c8b-9661-865e1cfdc9c0.json

2

.nyc_output/processinfo/index.json

@@ -1,1 +0,1 @@

{"processes":{"cc626e5d-5ef0-408f-9505-1c7f344aa9c1":{"parent":"dbac8624-69df-4d81-ba31-5665f3730b1b","children":[]},"dbac8624-69df-4d81-ba31-5665f3730b1b":{"parent":null,"children":["cc626e5d-5ef0-408f-9505-1c7f344aa9c1"]}},"files":{"/home/gor/Development/mongoose-slug-updater/index.js":["dbac8624-69df-4d81-ba31-5665f3730b1b"],"/home/gor/Development/mongoose-slug-updater/lib/slug-generator.js":["dbac8624-69df-4d81-ba31-5665f3730b1b"]},"externalIds":{}}
{"processes":{"19e80db7-1067-4c8b-9661-865e1cfdc9c0":{"parent":"d26a319a-25a0-4a66-8d25-a79e0beae0bd","children":[]},"d26a319a-25a0-4a66-8d25-a79e0beae0bd":{"parent":null,"children":["19e80db7-1067-4c8b-9661-865e1cfdc9c0"]}},"files":{"/home/gor/Development/mongoose-slug-updater/index.js":["d26a319a-25a0-4a66-8d25-a79e0beae0bd"],"/home/gor/Development/mongoose-slug-updater/lib/slug-generator.js":["d26a319a-25a0-4a66-8d25-a79e0beae0bd"]},"externalIds":{}}

@@ -337,2 +337,3 @@ const _ = require('deepdash')(require('lodash'));

findOne,
permanent
// slugsMdfPaths

@@ -384,3 +385,3 @@ ) {

};
} else {
} else if (!permanent) {
query = false;

@@ -577,2 +578,3 @@ }

cache,
slug.permanent
// slugsMdfPaths

@@ -615,2 +617,3 @@ ),

cache,
permanent,
// slugsMdfPaths

@@ -631,2 +634,3 @@ ) {

findOne,
permanent
// slugsMdfPaths

@@ -633,0 +637,0 @@ );

{
"name": "mongoose-slug-updater",
"version": "3.2.3",
"version": "3.3.0",
"description": "➔ Schema-based slug plugin for Mongoose ✓ single⋮compound ✓ unique within collection⋮group ✓ nested docs⋮arrays ✓ relative⋮abs paths ✓ sync on change: create⋮save⋮update⋮updateOne⋮updateMany⋮findOneAndUpdate ✓ $set operator ✓ counter⋮shortId",

@@ -59,5 +59,5 @@ "main": "index.js",

"dependencies": {
"deepdash": "^5.0.4",
"lodash": "^4.17.15",
"shortid": "^2.2.15",
"deepdash": "^5.3.5",
"lodash": "^4.17.20",
"shortid": "^2.2.16",
"speakingurl": "^14.0.1"

@@ -67,21 +67,21 @@ },

"babel-eslint": "^10.1.0",
"chai": "^4.2.0",
"chai": "^4.3.0",
"coveralls": "^3.1.0",
"eslint": "^7.1.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-mocha": "^7.0.0",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.20.0",
"mocha": "^7.2.0",
"mongodb-memory-server": "^6.6.1",
"mongoose": "^5.9.16",
"nodemon": "^2.0.4",
"nyc": "^15.0.1",
"prettier": "^2.0.5",
"snyk": "^1.332.0"
"eslint": "^7.20.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-mocha": "^8.0.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"mocha": "^8.3.0",
"mongodb-memory-server": "^6.9.3",
"mongoose": "^5.11.17",
"nodemon": "^2.0.7",
"nyc": "^15.1.0",
"prettier": "^2.2.1",
"snyk": "^1.457.0"
},
"snyk": true
}

@@ -24,2 +24,18 @@ const _ = require('lodash');

const childPermenantSchema = mongoose.Schema({
title: {
type: String,
required: true,
maxlength: 100,
},
slug: {
type: String,
slug: 'title',
index: true,
permanent: true,
slugPaddingSize: 4,
uniqueGroupSlug: '/_id',
},
});
const scratchSchema = mongoose.Schema({

@@ -56,3 +72,13 @@ title: {

const scratchPermanentSchema = mongoose.Schema({
title: {
type: String,
required: true,
maxlength: 100,
},
children: [childPermenantSchema],
});
const Scratch = mongoose.model('scratchSchema', scratchSchema);
const ScratchPermanent = mongoose.model('scratchPermenantSchema', scratchPermanentSchema);

@@ -111,2 +137,32 @@ describe('Grouped Nested Resources (Counter)', function () {

});
it('Update existing resource with additional child and check children are unique locally', async () => {
const doc = await ScratchPermanent.create({
title: 'This is a long title',
children: [
{
title: 'This is nested subtitle',
},
{
title: 'This is nested subtitle',
},
],
});
doc.children.push(
{
title: 'This is nested subtitle',
});
await doc.save();
doc.should.have.nested.property('children[0].title').and.equal('This is nested subtitle');
doc.should.have.nested.property('children[0].slug').and.equal('this-is-nested-subtitle');
doc.should.have.nested.property('children[1].title').and.equal('This is nested subtitle');
doc.should.have.nested.property('children[1].slug').and.equal('this-is-nested-subtitle-0001');
doc.should.have.nested.property('children[2].title').and.equal('This is nested subtitle');
doc.should.have.nested.property('children[2].slug').and.equal('this-is-nested-subtitle-0002');
});
});
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