-
Notifications
You must be signed in to change notification settings - Fork 94
Closed
Description
Problem
Consider the following client code:
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels