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

adonis-lucid-mongodb

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adonis-lucid-mongodb - npm Package Compare versions

Comparing version 1.0.42 to 1.0.43

2

package.json

@@ -8,3 +8,3 @@ {

},
"version": "1.0.42",
"version": "1.0.43",
"scripts": {

@@ -11,0 +11,0 @@ "lint": "standard",

@@ -31,3 +31,3 @@ # AdonisJS Lucid MongoDB

const users = yield User.where({name: 'peter'}).limit(10).fetch()
const users = yield User.where({name: 'peter'}).limit(10).skip(20).fetch()

@@ -39,5 +39,11 @@ const users = yield User.where({or: [{gender: 'female', age: {gte: 20}}, {gender: 'male', age: {gte: 22}}]}).fetch()

const users = yield User.where('age').gt(18).paginate(20)
const users = yield User.where('age', '>=', 18).fetch()
const users = yield User.where('age').gt(18).paginate(2, 100)
const users = yield User.where(function() {
this.where('age', '>=', 18)
}).fetch()
// to query geo near you need declare field type as geometry and add 2d or 2dsphere index in migration file

@@ -44,0 +50,0 @@ const images = yield Image.where({location: {near: {lat: 1, lng: 1}, maxDistance: 5000}}).fetch()

@@ -278,3 +278,3 @@ 'use strict'

const offset = util.returnOffset(page, perPage)
return this.skip(offset).limit(perPage)
return this.skip(offset).limit(perPage).find()
}

@@ -281,0 +281,0 @@

@@ -15,4 +15,2 @@ 'use strict'

const CE = require('../../Exceptions')
const objectId = require('mongodb').ObjectID
const moment = require('moment')
const debug = require('debug')('mquery')

@@ -66,5 +64,5 @@ const methods = exports = module.exports = {}

methods.paginate = function (target) {
return function * (page, perPage, countByQuery) {
return function (page, perPage, countByQuery) {
const serializer = new target.HostModel.QuerySerializer(target, this)
return yield serializer.paginate(page, perPage, countByQuery)
return serializer.paginate(page, perPage, countByQuery)
}

@@ -779,2 +777,4 @@ }

})
} else if (_.isFunction(arguments[0])) {
arguments[0].bind(this).call()
} else {

@@ -785,2 +785,22 @@ if (arguments.length === 2) {

target.modelQueryBuilder.where(key, value)
} else if (arguments.length === 3) {
switch (arguments[1]) {
case '=':
target.modelQueryBuilder.where(arguments[0]).eq(arguments[2])
break
case '>':
target.modelQueryBuilder.where(arguments[0]).gt(arguments[2])
break
case '>=':
target.modelQueryBuilder.where(arguments[0]).gte(arguments[2])
break
case '<':
target.modelQueryBuilder.where(arguments[0]).lt(arguments[2])
break
case '<=':
target.modelQueryBuilder.where(arguments[0]).lte(arguments[2])
break
default:
throw new CE.InvalidArgumentException(`Method "$${arguments[1]}" is not support by query builder`)
}
} else {

@@ -787,0 +807,0 @@ target.modelQueryBuilder.where(arguments[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