New
- Added
$minMaxScalerwindow operator. - Added
$toHashedIndexKeyexpression operator. - Added
mingo/init/contextmodule to provide a fully loaedContextobject. Context.initnow supports a record of operators.Queryobject autoloads query and projection operators.Aggregatorobject autoloads$match,$project, and$sortpipeline stage operators.- Module
mingo/init/basicis now a no-op.
Fixes
- Fix
$isArrayto support top-level expression arguments and improve validation.
Deprecated
The following will no longer be supported from 7.0.0.
useOperatorsfunction frommingo/core. Replaced withContext.getOperatorfunction frommingo/core. Replaced withContext.mingo/init/basicmodule is currently a no-op.mingo/init/systemmodule. Replace withmingo/init/contextwhich exports a context builder with all operators included.
Fixed
- Restore
"node"key inpackage.jsonexports to support Deno runtime. Closes #541.
Changed
- Handle comparison of custom types for stability of results.
- Treat native objects with object literal prototypes as plain object.
- Improve
$rankperformance by precomputing over entire window.
Added
- Support
$documentspipeline operator. Closes #533. - Support
$tanhtrignometry operator. - Support
$dateToStringformatters.%b(abbreviated month)%B(full month)%j(day of year)%w(day of week)
- Export
ProcessingModeso it is included in browser bundle. - Add minified bundle in
dist/mingo.min.jsfor use directly in browser.
Fixed
$bucket: Do not add default bucket to final output if empty.$round: Avoid potential infinite loop when rounding to negative places.$setWindowFields: Bubble up errors thrown in memoization helper.
Removed
- BREAKING: No longer support
mingo.remove()andQuery.remove()functions.
Fixes
- Fix field lookup on custom types. Regression introduced in
6.5.1. closes 529 - Fix default custom object string representation used for hashing. Regression introduced in
6.5.1.
Fixes
- Handle array indices in
$existsoperators. Reverts regression introduced in6.5.4. closes #528
Fixes
- Preserve root object for accumulator operators. closes #526
- Support nested elements in arrays for
$existsoperator. closes #524
Fixes
- Correct date equality checking. #518
- Run
sort,skip, andlimitin correct order onCursor. - Test inheritance chain for
toStringon custom types.
Improvements
- Precompile
$projectoperator for performance.
Fixes
$slice: handle negative skip values correctly. #503$setField: modify correct input object when adding new field.$convert: add missing BSON type strings.
Improvements
- Export default update function and factory in module index.
- Improve performance of
$bucketAutoby removing excessive hashing. - Simplify API for adding operators in Context class.
- Renamed
updateObject(..)toupdate(..). - Remove optimistic string representation on custom type without explicit
toString()method. - Expression operator
$typereturns"regexp"instead of"regex"whenuseStrictMode=false.
Fixes
- Use MongoDB comparator for
$cmp.
New
- Added
$densifypipeline stage operator. - Added
$graphLookuppipeline stage operator. - Added
$dateTruncexpression operator. - Support
$lookupby array and sub-queries with nested pipeline. - Support
granularityoption in$bucketAuto. - Add Olson timezone support for date operators.
- Expression operator
$typeuses JS type names whenuseStrictMode=falseorMongoDBtype names otherwise.- Types in non-strict mode:
"undefined","boolean", and"number". - Types in strict mode:
"missing","bool","int","long", and"double".
- Types in non-strict mode:
- Renamed
AnyVal->AnyandRawObject->AnyObject.
Fixes
- Implement
$dateDiffto be consistent with MongoDB. - Handle
nullinputs to$objectToArray,$setUnion,$map,$zip, and$filter. - Pass parent variables down to nested expressions.
- Include
idKeyfor$projectwhen no other fields are selected. - Removed caching of current timestamp for
$$NOWvariable in options. - Handle date inputs for
$subtractoperator. - Improve input validations for
$first,$last, and$ifNull. - Enforce string arguments validation for
$concat. - Update implementation of
$minand$maxto be consistent with new behaviour in latest MongoDB.
New
- Support custom type comparison using
toStringwhen defined on the type.
- ESM import broken. See #437
Update
- Add support for
Querycondition to updater function.
New
- Autoload basic query operators and expression operators for boolean and comparison for use with
Updater. #413 - Add explicit
MingoErrortype to represent errors caught by the library.
Fixes
- Revert "add import field to built package.json file to ensure proper vitest resolution (#420)
New
- Autoload basic query operators and expression operators for boolean and comparison for use with
Updater. #413 - Add explicit
MingoErrortype to represent errors caught by the library.
Fixes
- Add fix for Vitest. #420
Fixes
- Support BigInt only when available on platform #407
New
- Add support for accumulator and expression operators;
$percentile,$median.
Fixes
- Minor refactoring improvements to fix build issues in some web frameworks.
New
- Add support for bitwise aggregation operators.
$bitAnd,$bitOr,$bitXor,$bitNot. - Add support for typed arrays in
isEqual,cloneDeep, andstringify.
Fixes
- Build object graph for relevant update operators
$inc,$mul,$max,$min,$push,$bit. - Compare user-defined types with referential equality only with
isEqual. - Process user-defined types correctly with
stringify. - Properly handle cycles in
stringifyoperation.
Fixes
- Support nested object query expressions for
$pull. 373
Fixes
- Allow specifying only field expression for
$getFieldoperator. - Make place argument optional for
$truncand$round. 347 - Add and default to new clone mode
copyfor UpdateOptions. - Remove clone mode
structuredfor UpdateOptions.
Fixes
- Fixed incorrect query normalization when a regex condition is specified as an object literal. 355
- Restore generic type annotations for top-level classes. 357
Fixes
- Fix rounding of even whole numbers. 347
New
- Add
Contextto enable isolated configurations of usable operators in the same runtime context.
New
- Add options support for
updateObject. - Add
createUpdaterfor creating updater functions with default options. - Default to no cloning of inputs to update operators.
- Provide clone method configuration via
cloneModeoption.
New
- Added support for update operators accessible via
updateObjectfrommingo/updater. Includes;- Field Update Operators:
$currentDate,$inc,$max,$min,$mul,$set,$unset,$rename. - Array Update Operators:
$[],$[<identifier>],$addToSet,$pop,$push,$pull,$pushAll. - Bitwise Update Operators:
$bit.
- Field Update Operators:
Fixes
- Fixed hash collision resolution for
$sortand$group. Closes 332. - Support MongoDB compatibility truth check for
$whereoperator.
Minor
- Export
walkutil function. - Flatten module exports to expose only
indexroots. - Update dependencies.
- Deprecated due to invalid operator imports.
Fixes
- Coerce empty string
""totruefor applicable operators when using strict MongoDB compatibility mode. 321
Fixes
- Fix
$filterto properly handle truthy values. 320 - Fix
$arrayToObjectto flatten array before converting to objects.
Fixes
- Fix
$sizepredicate failing when applied to undefined array. 313 - Fix
$minand$maxoperators to consider type sorting order. - Fix
$groupoperator to enforce_idin spec. - Fix variable propagation from parent to child expressions. 315
- Fix missing validations for
$setWindowFieldsoperator.
New
- Add support for
$locfwindow operator. - Add support for
$linearFillwindow operator. - Add support for
$fillpipeline operator.
Fixes
- Ensure all variables are accessible in their local contexts. Closes 302
Fixes
- Ensure all variables are accessible in their local contexts. Closes 302
Fixes
- ADD .json files to package.json files array (#299)
Fixes
- Include
package.jsonin explicit module exports. - Create
package.jsonfiles for subpackages to support all ESM bundlers (#298)
Fixes
- Export all module paths explicitly for CommonJS and ES6 formats. Closes 295.
- Distribute package for both commongJS and as ES6 module.
Fixes
- Properly bind
$$thiswhen resolving fields using array operators. Closes 289
New
- Added array expression operators;
$maxN,$minN,$firstN,$lastN, and$sortArray. - Added accumulator operators;
$maxN,$minN,$first,$firstN,$last,$lastN,$top,$topN,$bottom, and$bottomN. - Added trignometry operators;
$coshand$sinh.
Fixes
- Correclt handle boundary values for trignometry functions.
- Nested arrays are projected correctly when excluded in results.
- Support MongoDB comparison sort order by data type.
Fixes
- Use correct context for resolving paths. Closes 284
- Support user-defined global variables.
Fixes
- Fix breaking change in
6.1.1. Closes 274 - Fix
$dateToStringformatter%Vto be week of year in ISO 8601 format (i.e.01-53) - Fix
$dateToStringformatter%uto be day of week number in ISO 8601 format (i.e.1-7) - Add
$dateToStringformatter%Ufor week of year.
Fixes
- Handle timezone correctly for
$dateToParts. Closes #256
Fixes
- Allow multiple expressions to
$ifNullconditional.
New
- Added
$dateDiffoperator. See #244
Fixes
- Correctly handle comparison of multiple deeply nested arrays. Fixes #238
Fixes
- Handle timezone letters for
$dateFromString. Fixes #228
Fixes
- Handle hash collisions to correct behaviour of set operators;
setEqual,$setIntersection,$setIsSubset, and$setUnion. - Support arbitrary number of arrays in
$setIntersection.
Fixes
- Remove use of
console.assert. See #226 - Remove deprecated
mingo/initimport.
Fixes
- Fix incorrect date bug when handling underflows in
dateFromParts. See #224
Fixes
- Fixed bug in
$dateFromPartswhich incorrectly computes the dates for some input values. See #223.
New
- Add option
processingModeto control input and output behaviour. - Add option
scriptEnabledto control whether to enable custom function operators;$where,$function, and$accumulator. - Add new operator type
OperatorType.WINDOW. - Add aggregation expression operators;
$accumulator$function$getField$setField$unsetField$sampleRate$replaceOne$replaceAll
- Add pipeline operators.
$setWindowFields$merge$unionWith
- Add window operators for
$setWindowFields.$denseRank$derivative$documentNumber$expMovingAvg$integral$rank$shift
- Add accumulator operators.
$count$covarianceSamp$covariancePop
- Add support for
$$NOWsystem variable. - Add ISO date operators.
$isoWeek$isoWeekYear$isoDayOfWeek
- Add support for
iso8601option to$dateToParts. - Add
useStrictModeoption to enable useful non-standard behaviour on specific operators.- The
$elemMatchprojection operator return all matching nested documents instead whenuseStrictModeisfalse.
- The
Removed
- Removed support for string function body in
$whereoperator. - Remove
addOperatorsfunction. - Removed
Collectiontype.
Fixes
- Fixed computation bug in
$dateAddand$dateSubtractoperators. - Fix bug in
sortBywhich causes duplicate values. - Fix ranking for duplicate values for
$denseRankoperator. - Fix cursor navigation bugs.
- Fix timezone handling in
$dateToStringoperator. - Return list of single item for
$countaggregation operator.
Changes not published. Updates moved to 6.0.0.
Changes not published. Updates moved to 6.0.0.
Fixes
- Remove
lodashreference in expression operators.
Features
- Add bitwise query operators.
$bitsAllClear$bitsAllSet$bitsAnyClear$bitsAnySet.
- Add
$jsonSchemaquery operator.
Features
- Add
$randaggregation and query operator
Fixes
- Support arbitrary input expressions for date operators
- Use hash function for deep-equality check in
unionfunction
- Add array operators
$firstand$last. - Add date operators
$dateAddand$dateSubtract.
- Use context object in
$filter.
- Add stronger type definitions for custom operators.
- Convert unit tests to Typescript.
- Update Typedocs.
- Fix
$unwindincorrectly removing0value, by correcting behaviour ofisEmpty
- Fix
$elemMatchto support top-level boolean operators$and,$or, and$nor
Features
- Added trignometry operators.
$sin$cos$tan$asin$acos$atan$atan2$asinh$acosh$atanh$degreesToRadians$radiansToDegrees
Features
- Added option
hashFunctionto enable custom hash functions - Added
$unsetpipeline operator - Added
$isNumberexpression operator - Added option
collectionResolverto resolve collections from names for use in supported operators. Closes #150 - Removed
$whereoperator from default query operators included at load time. Closes #155 Fixes - Support object type names with integer characters Other
- Improved type annotations
- Added ES lint to ensure code quality
- Added Prettier to maintain consistent code format
- Fix
isObjectto enforce plain Javascript objects. - Fix
collationoptions of$sortoperator - Merge
ConfigintoOptionstype - Pass
Optionsto predicate function for comparison operators - Replace
createConfigwithmakeOptions
- Fix $bucket default and boundaries mutation. Fixes #147
- Handle empty array values to
$notexpression operator.
- Handle non-array values to
$notexpression operator. Fixes #146
- Deprecate
mingo/initin favour of explicitmingo/init/basic.
- Remove
esmmodule dependency. Fixes #145
$mapoperator operand 'as', should default tothisif missing. Fixes #143
- Throw exception for specifying unregistered operators
- Fix regression bug in
$elemMatch. Closes #139
- Convert project to Typescript
- Build ES6 libraries with support for selective import
- Default export only
Aggregator,Query,aggregate(),find(), andremove() - Auto load only Query and Projection operators in main module via
mingo/init - Provide module
mingo/init/systemto auto load all operators - Expose library via
esmdependency to support module imports for ES5 - Implement type operators
$type,$convert,$toBool,$toDate,$toString,$toInt,$toLong,$toDouble,$toDecimal - Implement date operators
$dateFromString,$dateFromParts,dateToParts. - Implement string operators
$trim,$rtrim,$ltrim,$regexFind,$regexFindAll,$regexMatch - Add timezone support for all date operators
- Return all date operator results in UTC
- Split large expression operator groups to file per operator
- Rename
groupmodule toaccumulator - Removed
dist/files. Deferring to consumers to use their own packaging solutions - Removed
setup()function. Replaced by passing in config toQueryorAggregator. - Removed
VERSIONfields - Removed
_internal() - Pass only
computeValueandresolvefunctions to custom operator - Deprecate and replace
OP_XXXconstants with enumOperatorType.XXX. - Removed
CollectionMixin - Removed
Lazy,Cursor, andaddOperatorsfrom default export - Support extra options parameter on all operator functions
- Revert to using
dist/mingo.jsas main entry point for package. Fixes #125 - Fix build failures from updated dependencies
- Create minified files for previous version
- Refactored to support tree shaking
- Optionally add
Symbol.iteratorsupport if available in runtime environment. Closes #124 - Allow matching with nested fields in $lookup. Fixes #123
- Add $round operator and support 'place' argument for
$trunc. Fixes #121 - Support new array fields. Fixes #119
- Handle embedded document exclusions
- Do not enforce single value for
$facetaggregation pipeline operations. Fixes #110
- Add $set as $addFields alias. Fixes #113
- Fix $group operator idempotency issue. #82 (#114)
- Use renovateapp for dependency version management
- Correctly project and merge nested objects with missing keys.
- Properly flatten projected nested objects. Fixes #105
- Improve sort performance
- Fix sorting non-string values when collation is enabled.
- Correctly handle subqueries for
$elemMatch. Fixes #103
- Add support for collation on
Cursorobjects. Fixes #100
- Avoid resolving primitive type operands.
- Work around iOS 9 Safari compatibility problem (#98)
- Fixing typing for aggregator.run, make query optional. (#102)
- Minor cleanup and refactoring
- Correct changelog date
- Switch
inArrayandnotInArrayto useArray.prototype.includesfor performance. Fixes #95
- Project all matched elements of nested array correctly. Fixes #93
- Match missing fields correctly with
$exists
- Update
mergeObjectsto handle more use cases.
- Fix merge objects to project subdocuments correctly. Fixes #91
- Add
$$REMOVEsupport to conditionally exclude fields
- Match undefined fields with
$in: [null]queries (#85)
- Support
$unwindfor arrays nested in objects. Fixes #80
- Added
$exproperator. Fixes #79
- More Performance improvements for lazy evaluation
- Added
$mergeObjectsoperator - Change
Lazyto factory - Remove
Lazystatic methods exceptisIterator
- Use iterator input for Query
- Don't sort cursor modifiers
- Added new
Lazyiterator to re-implementCursorand pipeline operators - Added
Aggregator.streamto obtain iterator for stream pipeline results - Removed
Cursormethodsfirst()andlast()
- Add typescript declaration. Fixes #75
- Handle date values in
$addoperator. Fixes #73
- Fix
mapso it does not breakcloneDeep - Improve hash function
- Remove array size constraint on
$concatArrays. #64 - Filter out empty values from collection. #65
- Fix false positive tests and
$substrBytes. #66 $regexshould matched nested one level deep. #70
- Minimize cloning in pipeline operators
- Return new object for
$lookupwithout mutating original. Fixes #59 and #60 - Make
clonereturn shallow clone - Provide
cloneDeepfor deep cloning
- Removed custom polyfills
- Added
$strLenBytes,$strLenCP,$substrCP,$substrBytes - Fix
$indexOfBytes - Fix
$stdDevSamp - Fix
$infor aggregation operations - Removed max and min cursor methods.
- Restrict custom query operator type
OP_QUERYto return boolean only - Rename
OP_AGGREGATEtoOP_EXPRESSION - Update
$unwindto MongoDB 3.2 features
- Fix
computeValuenot overriding group operator keys after resolving expression - Added
$in,$objectToArray, and$arrayToObjectarray aggregation operators
- Restore
setupfunction. kofrasa#56
- Replaced core-js because it bloats compiled library by 10K i.e. ~24%
- Fix #55
- Support ES6 modules
- Fix matching null and missing values. kofrasa#54
- Improve comparing user-defined types
- Fix
$whereoperator not executed last. kofrasa#50 - Fix matching nested arrays. kofrasa#51
- Added
$facetand$bucketoperators - Added
$bucketAutooperator without granularity support - Added string keys for
$typeoperator - Added Cursor support for ES2015 Iterator Protocol
- Sort null/undefined values to front of sorted result
- Revert to operator names with format
Mingo.OP_<name>
- Optimize
$lookupimplementation - Avoid reversing original input to
$reverseArray
- Fix incorrect method call for ObjectProto
- Limit exposed util methods to type checking
- Renamed
Mingo.OP_<name>functions toMingo.KEY_<name> - Added pipeline stage operator (
$lookup)
- Updated polyfills to fix failing build on older node versions
- Added array aggregation operators
(
$arrayElemAt,$concatArrays,$filter,$indexOfArray,$isArray,$range,$reverseArray,$reduce,$slice,$zip) - Added string aggregation operators (
$indexOfBytes,$split) - Added arithmetic aggregation operators (
$ceil,$exp,$floor,$ln,$log,$log10,$pow,$sqrt,$trunc) - Added .editorconfig
- Pass utility functions to custom operator implementation
- Rename function to retrieve collection id to
idKeyin custom operators - Moved support for query projection streaming to a new package mingo-stream
- Fix resolving system variables with subpaths. See #41
- Added support for system variables (
$$ROOT,$$CURRENT) - Implemented more pipeline operators (
$redact,$addFields,$sample,$sortByCount,$count,$replaceRoot) - Added
$switchconditional operator - Fixed
$ifNullconditional operator - Allow use of
$inand$ninas aggregation comparison operators
- Fix querying deeply nested nested arrays and object equality matching. See #36
- Make this library zero-dependent
- Fix nested projections for objects and arrays. See #25
- Fix incorrect de-duping of Date types in $sort aggregate operator. See #23
- Support matching against user-defined types. See #22
- Fixed numeric aggregation over undefined values. See issues#21
- Fixed erroneous cloning of objects. See #20
- Fixed matching nested array fields without specifying index. See #19
- Added
VERSIONglobal field
- Added
$dateToStringaggregation operator
- Added support for extending operators via
Mingo.addOperators - Added
bower.json - Fixed grouping documents by an object key
- Fixed exclusive select projection not returning correct fields