File: replaceOne-upsert.yml

package info (click to toggle)
ruby-mongo 2.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,332 kB
  • sloc: ruby: 45,579; makefile: 5
file content (48 lines) | stat: -rw-r--r-- 1,400 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
data:
    - {_id: 1, x: 11}
    - {_id: 2, x: 22}
    - {_id: 3, x: 33}
minServerVersion: '2.6'
# See SERVER-5289 for why the collection data is only checked for server versions >= 2.6

tests:
    -
        description: "ReplaceOne with upsert when no documents match without an id specified"
        operation:
            name: "replaceOne"
            arguments:
                filter: {_id: 4}
                replacement: {x: 1}
                upsert: true

        outcome:
            result:
                matchedCount: 0
                modifiedCount: 0
                upsertedId: 4
            collection:
                data:
                    - {_id: 1, x: 11}
                    - {_id: 2, x: 22}
                    - {_id: 3, x: 33}
                    - {_id: 4, x: 1}
    -
        description: "ReplaceOne with upsert when no documents match with an id specified"
        operation:
            name: "replaceOne"
            arguments:
                filter: {_id: 4}
                replacement: {_id: 4, x: 1}
                upsert: true

        outcome:
            result:
                matchedCount: 0
                modifiedCount: 0
                upsertedId: 4
            collection:
                data:
                    - {_id: 1, x: 11}
                    - {_id: 2, x: 22}
                    - {_id: 3, x: 33}
                    - {_id: 4, x: 1}