Skip to content

Commit 4b810a7

Browse files
committed
GODRIVER-523: Support new readConcern level "available"
1 parent 3496960 commit 4b810a7

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed

core/readconcern/readconcern.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ func Linearizable() *ReadConcern {
4040
return New(Level("linearizable"))
4141
}
4242

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+
4349
// New constructs a new read concern from the given string.
4450
func New(options ...Option) *ReadConcern {
4551
concern := &ReadConcern{}

data/read-write-concern/connection-string/read-concern.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@
2424
"readConcern": {
2525
"level": "majority"
2626
}
27+
},
28+
{
29+
"description": "available specified",
30+
"uri": "mongodb://localhost/?readConcernLevel=available",
31+
"valid": true,
32+
"warning": false,
33+
"readConcern": {
34+
"level": "available"
35+
}
2736
}
2837
]
2938
}

data/read-write-concern/connection-string/read-concern.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,9 @@ tests:
1717
valid: true
1818
warning: false
1919
readConcern: { level: "majority" }
20+
-
21+
description: "available specified"
22+
uri: "mongodb://localhost?readConcernLevel=available"
23+
valid: true
24+
warning: false
25+
readConcern: { level: "available" }

data/read-write-concern/document/read-concern.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@
2828
"level": "local"
2929
},
3030
"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
3142
}
3243
]
3344
}

data/read-write-concern/document/read-concern.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@ tests:
1616
valid: true
1717
readConcern: { level: "local" }
1818
readConcernDocument: { level: "local" }
19+
isServerDefault: false
20+
-
21+
description: "Available"
22+
valid: true
23+
readConcern: { level: "available" }
24+
readConcernDocument: { level: "available" }
1925
isServerDefault: false

0 commit comments

Comments
 (0)