mingo
- Version 7.0.2
- Published
- 1.06 MB
- No dependencies
- MIT license
Install
npm i mingoyarn add mingopnpm add mingoOverview
MongoDB query language for in-memory objects
Index
Variables
variable _default
const _default: { Aggregator: typeof Aggregator; Context: typeof Context; ProcessingMode: typeof ProcessingMode; Query: typeof Query; aggregate: typeof aggregate; find: typeof find; update: typeof update; updateMany: typeof updateMany; updateOne: typeof updateOne;};Functions
function aggregate
aggregate: ( collection: Source, pipeline: AnyObject[], options?: Partial<Options>) => AnyObject[];Performs an aggregation operation on the provided collection using the specified pipeline.
Parameter collection
The input data source to aggregate.
Parameter pipeline
An array of aggregation stages to process the collection.
Parameter options
Optional settings to customize the aggregation behavior.
Returns
The result of the aggregation as an array of objects.
function find
find: <T>( collection: Source, condition: AnyObject, projection?: AnyObject, options?: Partial<Options>) => Cursor<T>;Finds documents in a collection that match the specified criteria.
T - The type of the documents in the collection.
Parameter collection
The source collection to search.
Parameter condition
The query criteria to filter the documents.
Parameter projection
Optional. Specifies the fields to include or exclude in the returned documents.
Parameter options
Optional. Additional options to customize the query behavior.
Returns
A
Cursorobject that allows iteration over the matching documents.
function update
update: ( obj: AnyObject, modifier: updater.Modifier, arrayFilters?: AnyObject[], condition?: AnyObject, options?: { cloneMode?: updater.CloneMode; queryOptions?: Partial<Options> }) => string[];function updateMany
updateMany: ( documents: AnyObject[], condition: AnyObject, modifer: updater.Modifier | updater.PipelineStage[], updateConfig?: updater.UpdateConfig, options?: Partial<Options>) => { matchedCount: number; modifiedCount: number };function updateOne
updateOne: ( documents: AnyObject[], condition: AnyObject, modifier: updater.Modifier | updater.PipelineStage[], updateConfig?: updater.UpdateConfig, options?: Partial<Options>) => updater.UpdateResult;Classes
class Aggregator
class Aggregator extends AggregatorBase {}constructor
constructor(pipeline: AnyObject[], options?: Partial<Options>);class Context
class Context {}The
Contextclass is a utility for managing and organizing operators of various types. It provides methods to initialize, merge, and retrieve operators, as well as add specific types of operators to the context.
method addAccumulatorOps
addAccumulatorOps: (ops: AccumulatorOps) => Context;method addExpressionOps
addExpressionOps: (ops: ExpressionOps) => Context;method addPipelineOps
addPipelineOps: (ops: PipelineOps) => Context;method addProjectionOps
addProjectionOps: (ops: ProjectionOps) => Context;method addQueryOps
addQueryOps: (ops: QueryOps) => Context;method addWindowOps
addWindowOps: (ops: WindowOps) => Context;method from
static from: (ctx?: Context) => Context;method getOperator
getOperator: (type: OpType, name: string) => Operator | null;method init
static init: (ops?: { accumulator?: AccumulatorOps; expression?: ExpressionOps; pipeline?: PipelineOps; projection?: ProjectionOps; query?: QueryOps; window?: WindowOps;}) => Context;method merge
static merge: (first: Context, second: Context) => Context;class Query
class Query extends QueryBase {}constructor
constructor(condition: AnyObject, options?: Partial<Options>);Enums
enum ProcessingMode
enum ProcessingMode { CLONE_OFF = 0, CLONE_INPUT = 1, CLONE_OUTPUT = 2, CLONE_ALL = 3,}Enum representing the processing modes for handling input and output documents. This determines whether cloning is applied to maintain immutability or ensure distinct object references.
member CLONE_ALL
CLONE_ALL = 3Clone both input and output documents. Combines
CLONE_INPUTandCLONE_OUTPUT.
member CLONE_INPUT
CLONE_INPUT = 1Clone input documents to maintain immutability of the original input.
member CLONE_OFF
CLONE_OFF = 0Do not clone inputs or outputs. Resulting documents may share references. This is the default mode.
member CLONE_OUTPUT
CLONE_OUTPUT = 2Clone output documents to ensure distinct objects without shared references.
Package Files (2)
Dependencies (0)
No dependencies.
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/mingo.
- Markdown[](https://www.jsdocs.io/package/mingo)
- HTML<a href="https://www.jsdocs.io/package/mingo"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4341 ms. - Missing or incorrect documentation? Open an issue for this package.
