6

How can I write the following query in ReactiveMongo.

db.products.insert(
   { item: "envelopes", qty : 100, type: "Clasp" },
   { writeConcern: { w: 2, wtimeout: 5000 } }
)

I have tried the like below.

db.products.insert(BSONDocument("item"->"envelopes","qty " -> 100,"type" -> "Clasp"))

Can you please suggest here how can I write the insert query with write concern in ReactiveMongo.

I have used writeConcern majority in DB connection like

val conOpts = MongoConnectionOptions(authMode = ScramSha1Authentication, authSource = Some(Configuration.dbName), writeConcern = WriteConcern.Default.copy(w = WriteConcern.Majority))
cchantep
  • 9,118
  • 3
  • 30
  • 41
newbie
  • 456
  • 1
  • 6
  • 17

0 Answers0