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
- In Progress
- related to
-
JAVA-5617 Add kotlin helper extensions Bson instances
- Backlog
-
JAVA-5601 Add Updates helper
- Closed
-
JAVA-5602 Add Sorts helper
- Closed
-
JAVA-5603 Add Projections helper
- Closed
-
JAVA-5605 Add Aggregates helper
- Closed
-
JAVA-5606 Add Accumulators helper
- Closed
-
JAVA-5619 Create Kotlin extensions branch and ci
- Closed
-
JAVA-5604 Add Indexes helper
- Closed