Updates a document already existing in the collection.

No upsert is done, see save instead.

var client = new MongoClient("mongodb://mongo:27017/")
var db_suffix = "NIT_TESTING_ID".environ
var db_name = "test_{db_suffix}"
var db = client.database(db_name)
var col = db.collection("test")
var sel = new JsonObject
sel["foo"] = 10
var upd = new JsonObject
upd["bar"] = "BAR"
assert col.update(sel, upd)

Property definitions

mongodb $ MongoCollection :: update
	# Updates a document already existing in the collection.
	#
	# No upsert is done, see `save` instead.
	#
	# ~~~
	# var client = new MongoClient("mongodb://mongo:27017/")
	# var db_suffix = "NIT_TESTING_ID".environ
	# var db_name = "test_{db_suffix}"
	# var db = client.database(db_name)
	# var col = db.collection("test")
	# var sel = new JsonObject
	# sel["foo"] = 10
	# var upd = new JsonObject
	# upd["bar"] = "BAR"
	# assert col.update(sel, upd)
	# ~~~
	fun update(selector: JsonObject, update: JsonObject): Bool do
		return native.update(
			selector.to_bson.native,
			update.to_bson.native)
	end
lib/mongodb/mongodb.nit:511,2--531,4