mongodb
- Description:
- MongoDB integration
- Source:
Classes
Methods
(static) exports.assertSafeQuery(input, errors)
- Description:
- Recursively checks a MongoDB query object for dangerous operators that could allow arbitrary code execution on the server.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
input |
* | The query object (or nested value) to check |
errors |
ErrorsModule | The app errors object |
Throws:
-
If a blocked operator is found
- Type
- AdaptError
(static) exports.convertObjectIds(o)
- Description:
- Checks an input object for any strings which pass the parse check and convert matches to ObjectId instances
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
o |
Object | Object to be checked |
(static) exports.createObjectId() → {external:MongoDBObjectId}
- Description:
- Creates a new ObjectId instance
- Source:
Returns:
- Type
- external:MongoDBObjectId
(static) exports.isObjectId(data) → {Boolean}
- Description:
- Checks if a value is a MongoDB ObjectId instance
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
data |
* | The value to check |
Returns:
- Type
- Boolean
(static) exports.isValidObjectId(s) → {Boolean}
- Description:
- Checks a string is a valid ObjectId
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
s |
String | String to check |
Returns:
- Type
- Boolean
(static) exports.parseObjectId(s) → {external:MongoDBObjectId}
- Description:
- Converts a string to an ObjectId
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
s |
String | The string to convert |
Throws:
Error
Returns:
The converted ID
- Type
- external:MongoDBObjectId
(static) exports.processParams(params) → {Object}
- Description:
- Validates and normalises query, data, and options before a database operation. Returns deep copies so the caller's originals are not mutated.
- Source:
Parameters:
| Name | Type | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
Returns:
- Type
- Object