File tree Expand file tree Collapse file tree 5 files changed +69
-0
lines changed Expand file tree Collapse file tree 5 files changed +69
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,11 @@ func Available() *ReadConcern {
46
46
return New (Level ("available" ))
47
47
}
48
48
49
+ // Only available for operations within multi-document transactions.
50
+ func Snapshot () * ReadConcern {
51
+ return New (Level ("snapshot" ))
52
+ }
53
+
49
54
// New constructs a new read concern from the given string.
50
55
func New (options ... Option ) * ReadConcern {
51
56
concern := & ReadConcern {}
Original file line number Diff line number Diff line change 33
33
"readConcern" : {
34
34
"level" : " available"
35
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
+ }
36
54
}
37
55
]
38
56
}
Original file line number Diff line number Diff line change @@ -23,3 +23,15 @@ tests:
23
23
valid : true
24
24
warning : false
25
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 39
39
"level" : " available"
40
40
},
41
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
42
64
}
43
65
]
44
66
}
Original file line number Diff line number Diff line change @@ -22,4 +22,16 @@ tests:
22
22
valid : true
23
23
readConcern : { level: "available" }
24
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" }
25
37
isServerDefault : false
You can’t perform that action at this time.
0 commit comments