UNPKG

14.3 kBMarkdownView Raw
1# Changelog
2
3## 5.0.0 / 2021-12-05
4
5**New**
6
7- Add option `processingMode` to control input and output behaviour.
8- Add option `scriptEnabled` to control whether to enable custom function operators; `$where`, `$function`, and `$accumulator`.
9- Add new operator type `OperatorType.WINDOW`.
10- Add aggregation expression operators;
11 - `$accumulator`
12 - `$function`
13 - `$getField`
14 - `$setField`
15 - `$unsetField`
16 - `$sampleRate`
17 - `$replaceOne`
18 - `$replaceAll`
19- Add pipeline operators.
20 - `$setWindowFields`
21 - `$merge`
22 - `$unionWith`
23- Add window operators for `$setWindowFields`.
24 - `$denseRank`
25 - `$derivative`
26 - `$documentNumber`
27 - `$expMovingAvg`
28 - `$integral`
29 - `$rank`
30 - `$shift`
31- Add accumulator operators.
32 - `$count`
33 - `$covarianceSamp`
34 - `$covariancePop`
35- Add support for `$$NOW` system variable.
36
37**Removed**
38
39- Removed support for string function body in `$where` operator.
40- Remove `addOperators` function.
41- Removed `Collection` type.
42
43**Fixes**
44
45- Fixed computation bug in `$dateAdd` and `$dateSubtract` operators.
46
47## 4.4.1 / 2021-11-16
48
49**Fixes**
50
51- Remove `lodash` reference in expression operators.
52
53## 4.4.0 / 2021-11-15
54
55**Features**
56
57- Add bitwise query operators.
58 - `$bitsAllClear`
59 - `$bitsAllSet`
60 - `$bitsAnyClear`
61 - `$bitsAnySet`.
62- Add `$jsonSchema` query operator.
63
64## 4.3.0 / 2021-11-07
65
66**Features**
67
68- Add `$rand` aggregation and query operator
69
70**Fixes**
71
72- Support arbitrary input expressions for date operators
73- Use hash function for deep-equality check in `union` function
74
75## 4.2.0 / 2021-09-26
76
77- Add array operators `$first` and `$last`.
78- Add date operators `$dateAdd` and `$dateSubtract`.
79
80## 4.1.5 / 2021-09-22
81
82- Fix regex not supported in `$all` query operator. [#190](https://github.com/kofrasa/mingo/issues/190)
83- Fix behaviour of `$setUnion`. [#192](https://github.com/kofrasa/mingo/issues/192)
84
85## 4.1.4 / 2021-08-06
86
87- Use context object in `$filter`.
88
89## 4.1.3 / 2021-07-12
90
91- Add stronger type definitions for custom operators.
92- Convert unit tests to Typescript.
93- Update Typedocs.
94
95## 4.1.2 / 2021-02-17
96
97- Fix `$unwind` incorrectly removing `0` value, by correcting behaviour of `isEmpty`
98
99## 4.1.1 / 2021-01-31
100
101- Fix `$elemMatch` to support top-level boolean operators `$and`,`$or`, and `$nor`
102
103## 4.1.0 / 2021-01-14
104
105**Features**
106
107- Added trignometry operators.
108 - `$sin`
109 - `$cos`
110 - `$tan`
111 - `$asin`
112 - `$acos`
113 - `$atan`
114 - `$atan2`
115 - `$asinh`
116 - `$acosh`
117 - `$atanh`
118 - `$degreesToRadians`
119 - `$radiansToDegrees`
120
121## 4.0.0 / 2021-01-07
122
123**Features**
124
125- Added option `hashFunction` to enable custom hash functions
126- Added `$unset` pipeline operator
127- Added `$isNumber` expression operator
128- Added option `collectionResolver` to resolve collections from names for use in supported operators. Closes [#150](https://github.com/kofrasa/mingo/issues/150)
129- Removed `$where` operator from default query operators included at load time. Closes [#155](https://github.com/kofrasa/mingo/issues/155)
130 **Fixes**
131- Support object type names with integer characters
132 **Other**
133- Improved type annotations
134- Added ES lint to ensure code quality
135- Added Prettier to maintain consistent code format
136
137## 3.1.0 / 2020-10-23
138
139- Fix `isObject` to enforce plain Javascript objects.
140- Fix `collation` options of `$sort` operator
141- Merge `Config` into `Options` type
142- Pass `Options` to predicate function for comparison operators
143- Replace `createConfig` with `makeOptions`
144
145## 3.0.6 / 2020-08-05
146
147- Fix $bucket default and boundaries mutation. Fixes [#147](https://github.com/kofrasa/mingo/issues/147)
148- Handle empty array values to `$not` expression operator.
149
150## 3.0.5 / 2020-07-20
151
152- Handle non-array values to `$not` expression operator. Fixes [#146](https://github.com/kofrasa/mingo/issues/146)
153
154## 3.0.4 / 2020-07-19
155
156- Deprecate `mingo/init` in favour of explicit `mingo/init/basic`.
157
158## 3.0.3 / 2020-07-16
159
160- Remove `esm` module dependency. Fixes [#145](https://github.com/kofrasa/mingo/issues/145)
161
162## 3.0.2 / 2020-05-22
163
164- `$map` operator operand 'as', should default to `this` if missing. Fixes [#143](https://github.com/kofrasa/mingo/pull/143)
165
166## 3.0.1 / 2020-04-27
167
168- Throw exception for specifying unregistered operators
169- Fix regression bug in `$elemMatch`. Closes [#139](https://github.com/kofrasa/mingo/issues/139)
170
171## 3.0.0 / 2020-04-12
172
173- Convert project to Typescript
174- Build ES6 libraries with support for selective import
175- Default export only `Aggregator`, `Query`, `aggregate()`, `find()`, and `remove()`
176- Auto load only Query and Projection operators in main module via `mingo/init`
177- Provide module `mingo/init/system` to auto load all operators
178- Expose library via `esm` dependency to support module imports for ES5
179- Implement type operators `$type`, `$convert`, `$toBool`, `$toDate`, `$toString`, `$toInt`, `$toLong`, `$toDouble`, `$toDecimal`
180- Implement date operators `$dateFromString`, `$dateFromParts`, `dateToParts`.
181- Implement string operators `$trim`, `$rtrim`, `$ltrim`, `$regexFind`, `$regexFindAll`, `$regexMatch`
182- Add timezone support for all date operators
183- Return all date operator results in UTC
184- Split large expression operator groups to file per operator
185- Rename `group` module to `accumulator`
186- Removed `dist/` files. Deferring to consumers to use their own packaging solutions
187- Removed `setup()` function. Replaced by passing in config to `Query` or `Aggregator`.
188- Removed `VERSION` fields
189- Removed `_internal()`
190- Pass only `computeValue` and `resolve` functions to custom operator
191- Deprecate and replace `OP_XXX` constants with enum `OperatorType.XXX`.
192- Removed `CollectionMixin`
193- Removed `Lazy`, `Cursor`, and `addOperators` from default export
194- Support extra options parameter on all operator functions
195
196## 2.5.2 / 2020-03-17
197
198- Revert to using `dist/mingo.js` as main entry point for package. Fixes [#125](https://github.com/kofrasa/mingo/issues/125)
199- Fix build failures from updated dependencies
200
201## 2.5.1 / 2020-03-16
202
203- Create minified files for previous version
204- Refactored to support tree shaking
205
206## 2.5.0 / 2020-03-08
207
208- Optionally add `Symbol.iterator` support if available in runtime environment. Closes [#124](https://github.com/kofrasa/mingo/issues/124)
209- Allow matching with nested fields in $lookup. Fixes [#123](https://github.com/kofrasa/mingo/issues/123)
210- Add $round operator and support 'place' argument for `$trunc`. Fixes [#121](https://github.com/kofrasa/mingo/issues/121)
211- Support new array fields. Fixes [#119](https://github.com/kofrasa/mingo/issues/119)
212- Handle embedded document exclusions
213
214## 2.4.0 / 2019-10-25
215
216- Do not enforce single value for `$facet` aggregation pipeline operations. Fixes #110
217
218## 2.3.6 / 2019-10-23
219
220- Add $set as $addFields alias. Fixes #113
221- Fix $group operator idempotency issue. #82 (#114)
222- Use renovateapp for dependency version management
223
224## 2.3.5 / 2019-05-04
225
226- Correctly project and merge nested objects with missing keys.
227
228## 2.3.4 / 2019-05-02
229
230- Properly flatten projected nested objects. Fixes #105
231
232## 2.3.3 / 2019-03-20
233
234- Improve sort performance
235
236## 2.3.2 / 2019-03-18
237
238- Fix sorting non-string values when collation is enabled.
239
240## 2.3.1 / 2019-03-13
241
242- Correctly handle subqueries for `$elemMatch`. Fixes #103
243
244## 2.3.0 / 2019-03-12
245
246- Add support for collation on `Cursor` objects. Fixes #100
247
248## 2.2.12 / 2019-03-09
249
250- Avoid resolving primitive type operands.
251
252## 2.2.11 / 2019-02-18
253
254- Work around iOS 9 Safari compatibility problem (#98)
255- Fixing typing for aggregator.run, make query optional. (#102)
256
257## 2.2.10 / 2019-01-04
258
259- Minor cleanup and refactoring
260- Correct changelog date
261
262## 2.2.9 / 2019-01-03
263
264- Switch `inArray` and `notInArray` to use `Array.prototype.includes` for performance. Fixes #95
265
266## 2.2.8 / 2018-12-01
267
268- Project all matched elements of nested array correctly. Fixes #93
269
270## 2.2.7 / 2018-11-30
271
272- Match missing fields correctly with `$exists`
273
274## 2.2.6 / 2018-11-22
275
276- Update `mergeObjects` to handle more use cases.
277
278## 2.2.5 / 2018-11-21
279
280- Fix merge objects to project subdocuments correctly. Fixes #91
281
282## 2.2.4 / 2018-09-09
283
284- Add `$$REMOVE` support to conditionally exclude fields
285
286## 2.2.3 / 2018-08-21
287
288- Match undefined fields with `$in: [null]` queries (#85)
289
290## 2.2.2 / 2018-04-17
291
292- Support `$unwind` for arrays nested in objects. Fixes [#80](https://github.com/kofrasa/mingo/issues/80)
293
294## 2.2.1 / 2018-04-14
295
296- Added `$expr` operator. Fixes [#79](https://github.com/kofrasa/mingo/issues/79)
297
298## 2.2.0 / 2018-01-25
299
300- More Performance improvements for lazy evaluation
301- Added `$mergeObjects` operator
302- Change `Lazy` to factory
303- Remove `Lazy` static methods except `isIterator`
304
305## 2.1.1 / 2017-12-18
306
307- Use iterator input for Query
308- Don't sort cursor modifiers
309
310## 2.1.0 / 2017-12-17
311
312- Added new `Lazy` iterator to re-implement `Cursor` and pipeline operators
313- Added `Aggregator.stream` to obtain iterator for stream pipeline results
314- Removed `Cursor` methods `first()` and `last()`
315
316## 2.0.5 / 2017-12-11
317
318- Add typescript declaration. Fixes [#75](https://github.com/kofrasa/mingo/pull/75)
319
320## 2.0.4 / 2017-10-19
321
322- Handle date values in `$add` operator. Fixes [#73](https://github.com/kofrasa/mingo/issues/73)
323
324## 2.0.3 / 2017-09-25
325
326- Fix `map` so it does not break `cloneDeep`
327- Improve hash function
328
329## 2.0.2 / 2017-09-14
330
331- Remove array size constraint on `$concatArrays`. [#64](https://github.com/kofrasa/mingo/issues/64)
332- Filter out empty values from collection. [#65](https://github.com/kofrasa/mingo/issues/65)
333- Fix false positive tests and `$substrBytes`. [#66](https://github.com/kofrasa/mingo/issues/66)
334- `$regex` should matched nested one level deep. [#70](https://github.com/kofrasa/mingo/issues/70)
335
336## 2.0.1 / 2017-09-07
337
338- Minimize cloning in pipeline operators
339- Return new object for `$lookup` without mutating original. Fixes #59 and #60
340- Make `clone` return shallow clone
341- Provide `cloneDeep` for deep cloning
342
343## 2.0.0 / 2017-08-12
344
345- Removed custom polyfills
346- Added `$strLenBytes`, `$strLenCP`, `$substrCP`, `$substrBytes`
347- Fix `$indexOfBytes`
348- Fix `$stdDevSamp`
349- Fix `$in` for aggregation operations
350- Removed max and min cursor methods.
351- Restrict custom query operator type `OP_QUERY` to return boolean only
352- Rename `OP_AGGREGATE` to `OP_EXPRESSION`
353- Update `$unwind` to MongoDB 3.2 features
354
355## 1.3.3 / 2017-08-02
356
357- Fix `computeValue` not overriding group operator keys after resolving expression
358- Added `$in`, `$objectToArray`, and `$arrayToObject` array aggregation operators
359
360## 1.3.2 / 2017-07-28
361
362- Restore `setup` function. https://github.com/kofrasa/mingo/issues/56
363
364## 1.3.1 / 2017-07-24
365
366- Replaced core-js because it bloats compiled library by 10K i.e. ~24%
367- Fix #55
368
369## 1.3.0 / 2017-07-23
370
371- Support ES6 modules
372- Fix matching null and missing values. https://github.com/kofrasa/mingo/issues/54
373- Improve comparing user-defined types
374
375## v1.2.0 / 2017-07-17
376
377- Fix `$where` operator not executed last. https://github.com/kofrasa/mingo/pull/50
378- Fix matching nested arrays. https://github.com/kofrasa/mingo/issues/51
379- Added `$facet` and `$bucket` operators
380- Added `$bucketAuto` operator without granularity support
381- Added string keys for `$type` operator
382- Added Cursor support for [ES2015 Iterator Protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols)
383- Sort null/undefined values to front of sorted result
384- Revert to operator names with format `Mingo.OP_<name>`
385
386## v1.1.2 / 2017-03-30
387
388- Optimize `$lookup` implementation
389- Avoid reversing original input to `$reverseArray`
390
391## v1.1.1 / 2017-03-12
392
393- Fix incorrect method call for ObjectProto
394- Limit exposed util methods to type checking
395
396## v1.1.0 / 2017-03-11
397
398- Renamed `Mingo.OP_<name>` functions to `Mingo.KEY_<name>`
399- Added pipeline stage operator (`$lookup`)
400
401## v1.0.1 / 2017-03-01
402
403- Updated polyfills to fix failing build on older node versions
404
405## v1.0.0 / 2017-02-28
406
407- Added array aggregation operators
408 (`$arrayElemAt`,`$concatArrays`,`$filter`,`$indexOfArray`,`$isArray`,`$range`,`$reverseArray`,`$reduce`,`$slice`,`$zip`)
409- Added string aggregation operators (`$indexOfBytes`,`$split`)
410- Added arithmetic aggregation operators (`$ceil`,`$exp`,`$floor`,`$ln`,`$log`,`$log10`,`$pow`,`$sqrt`,`$trunc`)
411- Added .editorconfig
412- Pass utility functions to custom operator implementation
413- Rename function to retrieve collection id to `idKey` in custom operators
414- Moved support for query projection streaming to a new package [mingo-stream](https://github.com/kofrasa/mingo-stream)
415
416## v0.9.1 / 2017-02-08
417
418- Fix resolving system variables with subpaths. See [#41](https://github.com/kofrasa/mingo/issues/41)
419
420## v0.9.0 / 2017-02-06
421
422- Added support for system variables (`$$ROOT`,`$$CURRENT`)
423- Implemented more pipeline operators (`$redact`,`$addFields`,`$sample`,`$sortByCount`,`$count`,`$replaceRoot`)
424- Added `$switch` conditional operator
425- Fixed `$ifNull` conditional operator
426- Allow use of `$in` and `$nin` as aggregation comparison operators
427
428## v0.8.1 / 2016-12-08
429
430- Fix querying deeply nested nested arrays and object equality matching. See [#36](https://github.com/kofrasa/mingo/issues/36)
431
432## v0.8.0 / 2016-09-26
433
434- Make this library zero-dependent
435
436## v0.7.0 / 2016-09-10
437
438- Fix nested projections for objects and arrays. See [#25](https://github.com/kofrasa/mingo/issues/25)
439
440## v0.6.5 / 2016-07-04
441
442- Fix incorrect de-duping of Date types in $sort aggregate operator. See [#23](https://github.com/kofrasa/mingo/pull/23)
443
444## v0.6.4 / 2016-05-19
445
446- Support matching against user-defined types. See [#22](https://github.com/kofrasa/mingo/issues/22)
447
448## v0.6.3 / 2015-12-27
449
450- Fixed numeric aggregation over undefined values. See [issues#21](https://github.com/kofrasa/mingo/issues/21)
451
452## v0.6.2 / 2015-11-17
453
454- Fixed erroneous cloning of objects. See [#20](https://github.com/kofrasa/mingo/pull/20)
455
456## v0.6.1 / 2015-09-20
457
458- Fixed matching nested array fields without specifying index. See [#19](https://github.com/kofrasa/mingo/issues/19)
459- Added `VERSION` global field
460
461## v0.6.0 / 2015-05-28
462
463- Added `$dateToString` aggregation operator
464
465## v0.5.0 / 2015-04-29
466
467- Added support for extending operators via `Mingo.addOperators`
468- Added `bower.json`
469- Fixed grouping documents by an object key
470- Fixed exclusive select projection not returning correct fields