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

mongolass

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongolass - npm Package Compare versions

Comparing version 4.1.1 to 4.1.2

4

changelog.md

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

## 4.1.2/2018-01-19
- fix: test
## 4.1.1/2018-01-19

@@ -2,0 +6,0 @@

5

package.json
{
"name": "mongolass",
"version": "4.1.1",
"version": "4.1.2",
"description": "Elegant MongoDB driver for Node.js.",

@@ -8,3 +8,4 @@ "main": "lib/index.js",

"pretest": "./node_modules/.bin/eslint .",
"test": "node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha"
"test": "node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha",
"prepublish": "npm run test"
},

@@ -11,0 +12,0 @@ "keywords": [

@@ -18,3 +18,3 @@ const MONGODB = process.env.MONGODB || 'mongodb://localhost:27017/test'

afterEach(function * () {
yield mongolass.model('User').remove()
yield mongolass.model('User').deleteMany()
})

@@ -205,3 +205,3 @@

it('.createCollection & .listCollections', function * () {
it('.createCollection & dropCollection & .listCollections', function * () {
yield mongolass.createCollection('test1')

@@ -213,3 +213,10 @@ yield mongolass.createCollection('test2')

assert.ok(_.includes(colls, 'test2'))
yield mongolass.dropCollection('test1')
yield mongolass.dropCollection('test2')
colls = yield mongolass.listCollections()
colls = _.map(colls, 'name')
assert.ok(!_.includes(colls, 'test1'))
assert.ok(!_.includes(colls, 'test2'))
})
})

@@ -16,3 +16,3 @@ const MONGODB = process.env.MONGODB || 'mongodb://localhost:27017/test'

afterEach(function * () {
yield mongolass.model('User').remove()
yield mongolass.model('User').deleteMany()
})

@@ -19,0 +19,0 @@

@@ -16,3 +16,3 @@ const MONGODB = process.env.MONGODB || 'mongodb://localhost:27017/test'

afterEach(function * () {
yield mongolass.model('User').remove()
yield mongolass.model('User').deleteMany()
})

@@ -19,0 +19,0 @@

@@ -21,3 +21,3 @@ const MONGODB = process.env.MONGODB || 'mongodb://localhost:27017/test'

afterEach(function * () {
yield mongolass.model('User').remove()
yield mongolass.model('User').deleteMany()
})

@@ -24,0 +24,0 @@

@@ -43,3 +43,3 @@ const MONGODB = process.env.MONGODB || 'mongodb://localhost:27017/test'

afterEach(function * () {
yield User.remove()
yield User.deleteMany()
})

@@ -92,3 +92,3 @@

yield User.remove({ name })
yield User.deleteMany({ name })
})

@@ -234,3 +234,3 @@

let count = yield User.count()
assert.deepEqual(count, 2)
assert.deepEqual(count, 1)
})

@@ -242,3 +242,3 @@

let count = yield User.count()
assert.deepEqual(count, 2)
assert.deepEqual(count, 1)
})

@@ -760,16 +760,14 @@

it('beforeRemove', function * () {
yield User.remove({ refe: '222222222222222222222222' })
yield User.create({
name: 'aaa',
age: 2,
refe: ObjectId('222222222222222222222222'),
posts: [{
title: 'aaa',
comments: [ObjectId('333333333333333333333333')]
}]
})
it.only('beforeRemove', function * () {
try {
yield User.remove({ refe: '222222222222222222222222' })
let count = yield User.count()
assert.deepEqual(count, 2)
let count = yield User.count()
assert.deepEqual(count, 1)
} catch (e) {
assert.deepEqual(e.op, 'remove')
assert.deepEqual(typeof e.args[0].refe, 'object')
assert.deepEqual(e.args[0].refe.toString(), '222222222222222222222222')
assert.ok(e.message.match('Cannot convert undefined or null to object'))
}
})

@@ -984,3 +982,3 @@

})
yield User.remove({ name: 'ccc' })
yield User.deleteOne({ name: 'ccc' })

@@ -1099,24 +1097,4 @@ try {

assert.deepEqual(doc.posts[0].comments.length, 4)
yield User.update({ 'posts.comments': '333333333333333333333333' }, { $pullAll: { 'posts.$.comments': ['333333333333333333333333', '555555555555555555555555', '666666666666666666666666'] } })
doc = yield User.findOne({ name: 'aaa' })
assert.deepEqual(doc.posts[0].comments.length, 0)
yield User.update({ name: 'aaa' }, { $push: {
'posts.0.comments': { $each: ['333333333333333333333333'] }
} })
})
it('$pushAll', function * () {
yield User.update({ name: 'aaa' }, { $pushAll: {
'posts.0.comments': ['555555555555555555555555', '666666666666666666666666']
} })
let doc = yield User.findOne({ name: 'aaa' })
assert.deepEqual(doc.posts[0].comments.length, 3)
yield User.update({ 'posts.comments': '333333333333333333333333' }, { $pullAll: { 'posts.$.comments': ['555555555555555555555555', '666666666666666666666666'] } })
doc = yield User.findOne({ name: 'aaa' })
assert.deepEqual(doc.posts[0].comments.length, 1)
})
it('$xxx', function * () {

@@ -1131,6 +1109,2 @@ let doc = yield User.findOne({ name: 'aaa' })

assert.deepEqual(doc.posts[0].comments.length, 0)
yield User.update({ name: 'aaa' }, { $pushAll: {
'posts.0.comments': ['333333333333333333333333']
} })
})

@@ -1140,35 +1114,35 @@

let error
// try {
// yield User.update({ name: 'aaa' }, null);
// } catch (e) {
// error = e;
// }
// assert.deepEqual(error, {
// name: 'MongoError',
// message: 'document must be a valid JavaScript object',
// driver: true,
// op: 'update',
// args: [ { name: 'aaa' }, null ],
// model: 'User',
// schema: 'User'
// });
try {
yield User.update({ name: 'aaa' }, null)
} catch (e) {
error = e
}
assert.deepEqual(error, {
name: 'MongoError',
message: 'document must be a valid JavaScript object',
driver: true,
op: 'update',
args: [ { name: 'aaa' }, null ],
model: 'User',
schema: 'User'
})
// try {
// yield User.update({ name: 'aaa' }, { age: -1 });
// } catch (e) {
// error = e;
// }
// assert.deepEqual(error, {
// validator: 'range',
// actual: -1,
// expected: { type: 'number', range: [ 0, 100 ] },
// path: '$.age',
// schema: 'User',
// model: 'User',
// op: 'update',
// args: [ { name: 'aaa' }, { age: -1 } ],
// pluginName: 'MongolassSchema',
// pluginOp: 'beforeUpdate',
// pluginArgs: []
// });
try {
yield User.update({ name: 'aaa' }, { age: -1 })
} catch (e) {
error = e
}
assert.deepEqual(error, {
validator: 'range',
actual: -1,
expected: { type: 'number', range: [ 0, 100 ] },
path: '$.age',
schema: 'User',
model: 'User',
op: 'update',
args: [ { name: 'aaa' }, { age: -1 } ],
pluginName: 'MongolassSchema',
pluginOp: 'beforeUpdate',
pluginArgs: []
})

@@ -1175,0 +1149,0 @@ try {

@@ -20,3 +20,3 @@ const MONGODB = process.env.MONGODB || 'mongodb://localhost:27017/test'

afterEach(function * () {
yield User.remove()
yield User.deleteMany()
})

@@ -23,0 +23,0 @@

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