You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import com.mongodb.client.model.Filters
import com.mongodb.client.MongoClient
private val client: MongoClient = ...
...
val data = mapOf("key1" to "value1", "key2" to "value2")
val filter = Filters.and(data.map {
Filters.eq(it.key, it.value)
})
client.getDatabase(db).getCollection(collection).updateOne(
filter,
Updates.set("dummy", "dummy"),
UpdateOptions().upsert(true)
)
When this is executed on an empty mongo java server collection, the expectation is to have a document with fields key1, key2 and dummy. However, key1 and key2 are not inserted even though that is a legitimate mongo client api usage.
The reason is that de.bwaldvogel.mongo.backend.AbstractMongoCollection.convertSelectorToDocument() has the following code:
if (key.startsWith("$")) {
continue;
}
Task
Fix the problem
The text was updated successfully, but these errors were encountered:
Problem
Consider the following client code:
When this is executed on an empty
mongo java server
collection, the expectation is to have a document with fieldskey1
,key2
anddummy
. However,key1
andkey2
are not inserted even though that is a legitimate mongo client api usage.The reason is that
de.bwaldvogel.mongo.backend.AbstractMongoCollection.convertSelectorToDocument()
has the following code:Task
Fix the problem
The text was updated successfully, but these errors were encountered: