@procedures/mongo 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/README.md +134 -705
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/storage/document-storage.d.ts +196 -0
- package/dist/storage/document-storage.d.ts.map +1 -0
- package/dist/storage/document-storage.js +694 -0
- package/dist/storage/document-storage.js.map +1 -0
- package/dist/storage/index.d.ts +6 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +4 -0
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/materializer.d.ts +354 -0
- package/dist/storage/materializer.d.ts.map +1 -0
- package/dist/storage/materializer.js +933 -0
- package/dist/storage/materializer.js.map +1 -0
- package/dist/storage/pipeline-scope.d.ts +73 -0
- package/dist/storage/pipeline-scope.d.ts.map +1 -0
- package/dist/storage/pipeline-scope.js +262 -0
- package/dist/storage/pipeline-scope.js.map +1 -0
- package/package.json +3 -3
- package/src/index.ts +17 -2
- package/src/storage/document-storage.ts +787 -0
- package/src/storage/index.ts +16 -0
- package/src/storage/materializer.ts +1044 -0
- package/src/storage/pipeline-scope.ts +281 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @procedures/mongo
|
|
2
2
|
|
|
3
|
+
## 0.9.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e192622: New `ViewMaterializer`: materialized views driven by change streams. A view is a document of a views collection, with a pipeline over source collections and a target collection, for one partition. The materializer computes each view again when its sources change, in the order of the dependencies. It keeps the status of each view (`ok`, `errored`, `cycle`).
|
|
8
|
+
|
|
9
|
+
- The rows of a view are a generation, and the status names the current one. A reader filters with the new `viewFilter(view)`, so it reads one whole generation.
|
|
10
|
+
- A run writes only the rows that changed, and removes the rows that the result does not have, in one transaction. A larger view (`maxTransactionRows`), or a failed transaction, writes a whole new generation in groups. The previous generation stays for `generationGrace`. A pass in groups holds a lease on its view (`passLease`), so two processes can keep the same views. The time options are durations of `@procedures/client`.
|
|
11
|
+
- The stored `_id` of a row carries its partition and its generation: `{ partition, generation, id }` by default (`partitionTargetId`), or the form of the option `targetId`. Two partitions with the same keys share a target.
|
|
12
|
+
- Targets from an older materializer, with the plain key as `_id`, need no migration step. The first pass of each view replaces the rows of its partition.
|
|
13
|
+
- Each pipeline goes through `scopePipeline` by default. It reads only its partition, in its sources, and the current generation of a target.
|
|
14
|
+
|
|
15
|
+
The code comes from the server of Graph (its split plan, part P4). The jobs of CI with a replica set start MongoDB with the test commands, for the failpoint tests.
|
|
16
|
+
- 054ba7d: `ViewMaterializer`: a change reaches only the views of its partition when the partition is known (roadmap CLI-37). The filter only removes work: a change whose partition is unknown reaches the views of each partition, as before.
|
|
17
|
+
|
|
18
|
+
- A delete has no document in its change event. Its partition comes from the pre-image, when its collection has `changeStreamPreAndPostImages`.
|
|
19
|
+
- The new option `storageSources` gives, for a collection of `MongoDocumentStorage`, the function from the storage partition (at the start of the id) to the partition of the views. `identityPartition` is for two partitions that are the same.
|
|
20
|
+
- With pre-images, an update that moves a document to another partition also reaches the views of its old partition.
|
|
21
|
+
- Without pre-images, a replace and an update of the partition field reach the views of each partition, as a delete does. The document can leave any partition.
|
|
22
|
+
- With `sourceFields`, the keys of an update are paths with dots: a `$push` (`tags.3`), a `$set` of `a.b`, a removal or a truncated array. Each key counts at the field, under it or above it, and the positions in arrays do not count (`lines.0.price` is `lines.price`). An update of the partition field starts a pass too.
|
|
23
|
+
- @procedures/client@0.9.2
|
|
24
|
+
- @procedures/collections@0.9.2
|
|
25
|
+
|
|
26
|
+
## 0.9.1
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- d7ad24e: New `MongoDocumentStorage` (roadmap CLI-24): a `CollectionStorage` over MongoDB. It has flat documents, a change log with tombstones for an exact `getChangesSince()`, versions (`versionOf()`), queries in the database (`query()`), `patch()` and partitions (`forPartition()`).
|
|
31
|
+
|
|
32
|
+
On a replica set, each write is a transaction with its numbers. On a single server, a watermark of the pending numbers keeps the log exact, and a late write moves its documents to new numbers. An id cannot have the character U+001F, and each write filter has the partition. It passes the `CollectionStorage` contract on MongoDB 7. `MongoStorage` keeps its `{ _id, data }` documents. CI has a MongoDB job, and the coverage job starts the storage tests on MongoDB.
|
|
33
|
+
- 28d82c9: The time options of the new storage APIs take a `Duration` of `@procedures/client`, as the other time options of the client do (roadmap R11). A plain number is a `TypeError`.
|
|
34
|
+
|
|
35
|
+
- `MongoDocumentStorage`: the option `writeLease` (default `seconds(60)`) replaces `writeLeaseMs`.
|
|
36
|
+
- `MongoDocumentStorage.aggregate()` and `PipelineLimits`: `maxTime` (default `seconds(10)`) replaces `maxTimeMS`. `DEFAULT_PIPELINE_LIMITS` has `maxTime`.
|
|
37
|
+
|
|
38
|
+
These APIs are new in this release, so no released code changes. The procedure `mongo.documents.aggregate` keeps its input `maxTimeMS` in milliseconds: the wire keeps milliseconds.
|
|
39
|
+
- 3b2ddcd: New `scopePipeline()`: the guard of an aggregation pipeline over shared collections. The filter of the scope goes on each read of the pipeline and of its sub-pipelines. The pipeline reads and writes only the collections of the scope. Only the document stages of `ALLOWED_PIPELINE_STAGES` pass. `$out` and the JavaScript operators of the server are refused, and `$merge` needs a stamp. New `boundPipeline()`, `cutResults()` and `isTimeLimitError()` give the limits of time and size.
|
|
40
|
+
|
|
41
|
+
New `MongoDocumentStorage.aggregate()`: a read-only pipeline on the items of the partition, with these limits. The code comes from the server of Graph (its split plan, part P3).
|
|
42
|
+
- Updated dependencies [61d60c6]
|
|
43
|
+
- Updated dependencies [79f750a]
|
|
44
|
+
- Updated dependencies [d0c9856]
|
|
45
|
+
- Updated dependencies [b5db4d8]
|
|
46
|
+
- @procedures/client@0.9.1
|
|
47
|
+
- @procedures/collections@0.9.1
|
|
48
|
+
|
|
3
49
|
## 0.9.0
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|