flow
Search…
firstWriteWins and lastWriteWins
Using the firstWriteWins and lastWriteWins reduction strategies
firstWriteWins always takes the first value seen at the annotated location. Likewise, lastWriteWins always takes the last. Schemas that don’t have an explicit reduce annotation default to lastWriteWins behavior.
1
collections:
2
- name: example/reductions/fww-lww
3
schema:
4
type: object
5
reduce: { strategy: merge }
6
properties:
7
key: { type: string }
8
fww: { reduce: { strategy: firstWriteWins } }
9
lww: { reduce: { strategy: lastWriteWins } }
10
required: [key]
11
key: [/key]
12
13
tests:
14
"Expect we can track first- and list-written values":
15
- ingest:
16
collection: example/reductions/fww-lww
17
documents:
18
- { key: "key", fww: "one", lww: "one" }
19
- { key: "key", fww: "two", lww: "two" }
20
- verify:
21
collection: example/reductions/fww-lww
22
documents:
23
- { key: "key", fww: "one", lww: "two" }
Copied!

Last modified 3mo ago
Copy link
Contents