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

hapi-mongo-models

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-mongo-models - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"name": "hapi-mongo-models",
"version": "1.0.2",
"version": "1.0.3",
"description": "MongoDB object models for hapi applications",

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

@@ -117,3 +117,13 @@ # hapi-mongo-models

The options passed to the plugin is an object where:
- `mongodb` - is an object where:
- `url` - a string representing the connection url for MongoDB.
- `settings` - an optional object passed to the MongoDB's native connect function.
- `autoIndex` - a boolean specifying if the plugin should call `ensureIndex` for each
model. Defaults to `true`. Typically set to `false` in production environments.
- `models` - an object where each key is the exposed model name and each value is the
path (relative to the current working directory) of where to find the model on disk.
## API

@@ -126,4 +136,4 @@

- `protoProps` - an object defining the prototype of the new class where:
- `constructor` - an optional function that will be used as the instance
constructor.
- `constructor` - an optional function that will be used as the instance
constructor.

@@ -161,8 +171,8 @@ ```js

- `config` - an object with the following keys:
- `url` - the connection string passed to `MongoClient.connect`.
- `settings` - an optional object passed to `MongoClient.connect`.
- `url` - the connection string passed to `MongoClient.connect`.
- `settings` - an optional object passed to `MongoClient.connect`.
- `callback` - the callback method using the signature `function (err, db)`
where:
- `err` - if the connection failed, the error reason, otherwise `null`.
- `db` - if the connection succeeded, the initialized db object.
where:
- `err` - if the connection failed, the error reason, otherwise `null`.
- `db` - if the connection succeeded, the initialized db object.

@@ -185,6 +195,6 @@ #### `disconnect()`

- `callback` - is the callback method using the signature `function (err,
value)` where:
- `err` - if validation failed, the error reason, otherwise null.
- `value` - the validated value with any type conversions and other
modifiers applied.
value)` where:
- `err` - if validation failed, the error reason, otherwise null.
- `value` - the validated value with any type conversions and other
modifiers applied.

@@ -199,6 +209,6 @@ See: https://github.com/hapijs/joi#validatevalue-schema-options-callback

- `callback` - is the callback method using the signature `function (err,
value)` where:
- `err` - if validation failed, the error reason, otherwise null.
- `value` - the validated value with any type conversions and other
modifiers applied.
value)` where:
- `err` - if validation failed, the error reason, otherwise null.
- `value` - the validated value with any type conversions and other
modifiers applied.

@@ -222,27 +232,27 @@ See: https://github.com/hapijs/joi#validatevalue-schema-options-callback

- `query` - is a query object, defining the conditions the documents need to
apply.
apply.
- `fields` - indicates which fields should be included in the response
(default is all). Can be a string with space separated field names.
(default is all). Can be a string with space separated field names.
- `sort` - indicates how to sort documents. Can be a string with space
separated fields. Fields may be prefixed with `-` to indicate decending
sort order.
separated fields. Fields may be prefixed with `-` to indicate decending
sort order.
- `limit` - a number indicating how many results should be returned.
- `page` - a number indicating the current page.
- `callback` - is the callback method using the signature `function (err,
results)` where:
- `err` - if the query failed, the error reason, otherwise null.
- `results` - the results object where:
- `data` - an array of results from the query.
- `pages` - an object where:
- `current` - a number indicating the current page.
- `prev` - a number indicating the previous page.
- `hasPrev` - a boolean indicating if there is a previous page.
- `next` - a number indicating the next page.
- `hasNext` - a boolean indicating if there is a next page.
- `total` - a number indicating the total number of pages.
- `items` - an object where:
- `limit` - a number indicating the how many results should be returned.
- `begin` - a number indicating what item number the results begin with.
- `end` - a number indicating what item number the results end with.
- `total` - a number indicating the total number of matching results.
results)` where:
- `err` - if the query failed, the error reason, otherwise null.
- `results` - the results object where:
- `data` - an array of results from the query.
- `pages` - an object where:
- `current` - a number indicating the current page.
- `prev` - a number indicating the previous page.
- `hasPrev` - a boolean indicating if there is a previous page.
- `next` - a number indicating the next page.
- `hasNext` - a boolean indicating if there is a next page.
- `total` - a number indicating the total number of pages.
- `items` - an object where:
- `limit` - a number indicating the how many results should be returned.
- `begin` - a number indicating what item number the results begin with.
- `end` - a number indicating what item number the results end with.
- `total` - a number indicating the total number of matching results.

@@ -273,8 +283,8 @@ #### `fieldsAdapter(fields)`

- `id` - is a string value of the id to find. It will be casted to the type
of `_idClass`.
of `_idClass`.
- `options` - an options object passed to MongoDB's native `findOne` method.
- `callback` - the callback method using the signature `function (err, results)`
where:
- `err` - if the query failed, the error reason, otherwise `null`.
- `results` - if the query succeeded, the results of the query.
where:
- `err` - if the query failed, the error reason, otherwise `null`.
- `results` - if the query succeeded, the results of the query.

@@ -288,10 +298,10 @@ Note: `callback` passes through `resultFactory`.

- `id` - is a string value of the id to find. It will be casted to the type
of `_idClass`.
of `_idClass`.
- `update` - an object containing the fields/values to be updated.
- `options` - an optional options object passed to MongoDB's native
`findAndModify` method.
`findAndModify` method.
- `callback` - the callback method using the signature `function (err, results)`
where:
- `err` - if the query failed, the error reason, otherwise `null`.
- `results` - if the query succeeded, the results of the query.
where:
- `err` - if the query failed, the error reason, otherwise `null`.
- `results` - if the query succeeded, the results of the query.

@@ -306,6 +316,6 @@

- `id` - is a string value of the id to find. It will be casted to the type
of `_idClass`.
of `_idClass`.
- `callback` - the callback method using the signature `function (err)`
where:
- `err` - if the query failed, the error reason, otherwise `null`.
where:
- `err` - if the query failed, the error reason, otherwise `null`.

@@ -312,0 +322,0 @@ ### Proxied methods

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