Skip to content

Commit e753db4

Browse files
authored
Certify mongodb plugin (#3115)
* fix(mongodb): use "majority" as the default write concern The current default, an empty string, causes an error when the output is used: ``` Failed to send message to mongodb: (BadValue) cannot use non-majority 'w' mode "" when a host is not a member of a replica set ``` This commit changes the default to "majority" which the MongoDB docs describe as ["the default write concern for most MongoDB deployments"](https://www.mongodb.com/docs/manual/reference/write-concern/#w-option). * feat(mongodb): certify plugin
1 parent 0df768f commit e753db4

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

docs/modules/components/pages/outputs/mongodb.adoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ output:
4646
collection: "" # No default (required)
4747
operation: update-one
4848
write_concern:
49-
w: ""
49+
w: majority
5050
j: false
5151
w_timeout: ""
5252
document_map: ""
@@ -79,7 +79,7 @@ output:
7979
collection: "" # No default (required)
8080
operation: update-one
8181
write_concern:
82-
w: ""
82+
w: majority
8383
j: false
8484
w_timeout: ""
8585
document_map: ""
@@ -197,12 +197,12 @@ The write concern settings for the mongo connection.
197197
198198
=== `write_concern.w`
199199
200-
W requests acknowledgement that write operations propagate to the specified number of mongodb instances.
200+
W requests acknowledgement that write operations propagate to the specified number of mongodb instances. Can be the string "majority" to wait for a calculated majority of nodes to acknowledge the write operation, or an integer value specifying an minimum number of nodes to acknowledge the operation, or a string specifying the name of a custom write concern configured in the cluster.
201201
202202
203203
*Type*: `string`
204204
205-
*Default*: `""`
205+
*Default*: `"majority"`
206206
207207
=== `write_concern.j`
208208

docs/modules/components/pages/processors/mongodb.adoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mongodb:
4545
collection: "" # No default (required)
4646
operation: insert-one
4747
write_concern:
48-
w: ""
48+
w: majority
4949
j: false
5050
w_timeout: ""
5151
document_map: ""
@@ -71,7 +71,7 @@ mongodb:
7171
collection: "" # No default (required)
7272
operation: insert-one
7373
write_concern:
74-
w: ""
74+
w: majority
7575
j: false
7676
w_timeout: ""
7777
document_map: ""
@@ -176,12 +176,12 @@ The write concern settings for the mongo connection.
176176
177177
=== `write_concern.w`
178178
179-
W requests acknowledgement that write operations propagate to the specified number of mongodb instances.
179+
W requests acknowledgement that write operations propagate to the specified number of mongodb instances. Can be the string "majority" to wait for a calculated majority of nodes to acknowledge the write operation, or an integer value specifying an minimum number of nodes to acknowledge the operation, or a string specifying the name of a custom write concern configured in the cluster.
180180
181181
182182
*Type*: `string`
183183
184-
*Default*: `""`
184+
*Default*: `"majority"`
185185
186186
=== `write_concern.j`
187187

internal/impl/mongodb/common.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ const (
260260
func writeConcernDocs() *service.ConfigField {
261261
return service.NewObjectField(commonFieldWriteConcern,
262262
service.NewStringField(commonFieldWriteConcernW).
263-
Description("W requests acknowledgement that write operations propagate to the specified number of mongodb instances.").
264-
Default(""),
263+
Description(`W requests acknowledgement that write operations propagate to the specified number of mongodb instances. Can be the string "majority" to wait for a calculated majority of nodes to acknowledge the write operation, or an integer value specifying an minimum number of nodes to acknowledge the operation, or a string specifying the name of a custom write concern configured in the cluster.`).
264+
Default("majority"),
265265
service.NewBoolField(commonFieldWriteConcernJ).
266266
Description("J requests acknowledgement from MongoDB that write operations are written to the journal.").
267267
Default(false),

internal/impl/mongodb/processor.go

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030

3131
const (
3232
mpFieldCollection = "collection"
33-
mpFieldWriteConcern = "write_concern"
3433
mpFieldJSONMarshalMode = "json_marshal_mode"
3534
)
3635

internal/plugins/info.csv

+4-4
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ memcached ,cache ,Memcached ,0.0.0 ,commun
122122
memory ,buffer ,Memory ,0.0.0 ,certified ,n ,y ,y
123123
memory ,cache ,Memory ,0.0.0 ,certified ,n ,y ,y
124124
metric ,processor ,metric ,0.0.0 ,certified ,n ,y ,y
125-
mongodb ,cache ,MongoDB ,3.43.0 ,community ,n ,n ,n
126-
mongodb ,input ,MongoDB ,3.64.0 ,community ,n ,n ,n
127-
mongodb ,output ,MongoDB ,3.43.0 ,community ,n ,n ,n
128-
mongodb ,processor ,MongoDB ,3.43.0 ,community ,n ,n ,n
125+
mongodb ,cache ,MongoDB ,3.43.0 ,certified ,n ,y ,y
126+
mongodb ,input ,MongoDB ,3.64.0 ,certified ,n ,y ,y
127+
mongodb ,output ,MongoDB ,3.43.0 ,certified ,n ,y ,y
128+
mongodb ,processor ,MongoDB ,3.43.0 ,certified ,n ,y ,y
129129
mqtt ,input ,mqtt ,4.37.0 ,certified ,n ,y ,y
130130
mqtt ,output ,mqtt ,4.37.0 ,certified ,n ,y ,y
131131
msgpack ,processor ,msgpack ,3.59.0 ,community ,n ,n ,n

public/components/cloud/package.go

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
_ "github.com/redpanda-data/connect/v4/public/components/kafka/enterprise"
3030
_ "github.com/redpanda-data/connect/v4/public/components/maxmind"
3131
_ "github.com/redpanda-data/connect/v4/public/components/memcached"
32+
_ "github.com/redpanda-data/connect/v4/public/components/mongodb"
3233
_ "github.com/redpanda-data/connect/v4/public/components/mqtt"
3334
_ "github.com/redpanda-data/connect/v4/public/components/msgpack"
3435
_ "github.com/redpanda-data/connect/v4/public/components/mysql"

0 commit comments

Comments
 (0)