Can we add Filters support for Dataclass properties?
We have heard from a customer that find() does not support @SerialName annotations, but that insertOne() does. A related community forums ticket as well: https://www.mongodb.com/community/forums/t/nested-data-class-filters/239472.
@Serializable data class ListDto( @Contextual @SerialName("_id") val id: Id<ListDto> = ObjectId().toId(), @Contextual var userId: Id<UserDto>, var name: String, val categories: MutableList<CategoryDto> = mutableListOf(), var icon: String, // Single emoji at the moment var color: String // Represented as #RRGGBB hex color ) @Serializable data class CategoryDto( @Contextual @SerialName("_id") val id: Id<CategoryDto> = ObjectId().toId(), var name: String, var color: String // Represented as #010101 hex color )What I need to do is update a single property (for example the name) in one of the categories items, filtering via the id.
In Kmongo I was using
return col.findOneAndUpdate( and(ListDto::id eq listId, ListDto::userId eq userId, (ListDto::categories / CategoryDto::id) eq categoryId), set(*properties.toTypedArray()), FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER) )
- is related to
-
JAVA-5338 KBson & Polymorphic - Update operations
- Backlog