File tree Expand file tree Collapse file tree 5 files changed +107
-0
lines changed Expand file tree Collapse file tree 5 files changed +107
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,17 @@ func Linearizable() *ReadConcern {
40
40
return New (Level ("linearizable" ))
41
41
}
42
42
43
+ // Available specifies that the query should return data from the instance with no guarantee
44
+ // that the data has been written to a majority of the replica set members (i.e. may be rolled back).
45
+ func Available () * ReadConcern {
46
+ return New (Level ("available" ))
47
+ }
48
+
49
+ // Snapshot is only available for operations within multi-document transactions.
50
+ func Snapshot () * ReadConcern {
51
+ return New (Level ("snapshot" ))
52
+ }
53
+
43
54
// New constructs a new read concern from the given string.
44
55
func New (options ... Option ) * ReadConcern {
45
56
concern := & ReadConcern {}
Original file line number Diff line number Diff line change 24
24
"readConcern" : {
25
25
"level" : " majority"
26
26
}
27
+ },
28
+ {
29
+ "description" : " available specified" ,
30
+ "uri" : " mongodb://localhost/?readConcernLevel=available" ,
31
+ "valid" : true ,
32
+ "warning" : false ,
33
+ "readConcern" : {
34
+ "level" : " available"
35
+ }
36
+ },
37
+ {
38
+ "description" : " snapshot specified" ,
39
+ "uri" : " mongodb://localhost/?readConcernLevel=snapshot" ,
40
+ "valid" : true ,
41
+ "warning" : false ,
42
+ "readConcern" : {
43
+ "level" : " snapshot"
44
+ }
45
+ },
46
+ {
47
+ "description" : " linearizable specified" ,
48
+ "uri" : " mongodb://localhost/?readConcernLevel=linearizable" ,
49
+ "valid" : true ,
50
+ "warning" : false ,
51
+ "readConcern" : {
52
+ "level" : " linearizable"
53
+ }
27
54
}
28
55
]
29
56
}
Original file line number Diff line number Diff line change @@ -17,3 +17,21 @@ tests:
17
17
valid : true
18
18
warning : false
19
19
readConcern : { level: "majority" }
20
+ -
21
+ description : " available specified"
22
+ uri : " mongodb://localhost?readConcernLevel=available"
23
+ valid : true
24
+ warning : false
25
+ readConcern : { level: "available" }
26
+ -
27
+ description : " snapshot specified"
28
+ uri : " mongodb://localhost?readConcernLevel=snapshot"
29
+ valid : true
30
+ warning : false
31
+ readConcern : { level: "snapshot" }
32
+ -
33
+ description : " linearizable specified"
34
+ uri : " mongodb://localhost?readConcernLevel=linearizable"
35
+ valid : true
36
+ warning : false
37
+ readConcern : { level: "linearizable" }
Original file line number Diff line number Diff line change 28
28
"level" : " local"
29
29
},
30
30
"isServerDefault" : false
31
+ },
32
+ {
33
+ "description" : " Available" ,
34
+ "valid" : true ,
35
+ "readConcern" : {
36
+ "level" : " available"
37
+ },
38
+ "readConcernDocument" : {
39
+ "level" : " available"
40
+ },
41
+ "isServerDefault" : false
42
+ },
43
+ {
44
+ "description" : " Snapshot" ,
45
+ "valid" : true ,
46
+ "readConcern" : {
47
+ "level" : " snapshot"
48
+ },
49
+ "readConcernDocument" : {
50
+ "level" : " snapshot"
51
+ },
52
+ "isServerDefault" : false
53
+ },
54
+ {
55
+ "description" : " Linearizable" ,
56
+ "valid" : true ,
57
+ "readConcern" : {
58
+ "level" : " linearizable"
59
+ },
60
+ "readConcernDocument" : {
61
+ "level" : " linearizable"
62
+ },
63
+ "isServerDefault" : false
31
64
}
32
65
]
33
66
}
Original file line number Diff line number Diff line change @@ -16,4 +16,22 @@ tests:
16
16
valid : true
17
17
readConcern : { level: "local" }
18
18
readConcernDocument : { level: "local" }
19
+ isServerDefault : false
20
+ -
21
+ description : " Available"
22
+ valid : true
23
+ readConcern : { level: "available" }
24
+ readConcernDocument : { level: "available" }
25
+ isServerDefault : false
26
+ -
27
+ description : " Snapshot"
28
+ valid : true
29
+ readConcern : { level: "snapshot" }
30
+ readConcernDocument : { level: "snapshot" }
31
+ isServerDefault : false
32
+ -
33
+ description : " Linearizable"
34
+ valid : true
35
+ readConcern : { level: "linearizable" }
36
+ readConcernDocument : { level: "linearizable" }
19
37
isServerDefault : false
You can’t perform that action at this time.
0 commit comments