Can anyone help with a MongoTemplate question? I h...
# spring
a
Can anyone help with a MongoTemplate question? I have got a record structure which has nested arrays and I want to update a specific entry in a 2nd level array. I can find the appropriate entry easier enough by the Set path needs the indexes of both array entries & the '$' only refers to the leaf item. For example if I had an array of teams which contained an array of player I need to generate an update path like :
Copy code
val query = Query(Criteria.where("teams.players.playerId").`is`(playerId))
        val update = Update()
        with(update) {
            set("teams.$.players.$.name", player.name)
        ...
This fails as the '$' can only be used once to refer to the index in the players array, I need a way to generate the equivalent '$' for the index in the teams array. Any ideas for this Mongo newbie?
stackoverflow 2
c
This is not related to use of kotlin and therefore off-topic on this slack. Try posting on Stack Overflow or mongo-related resources.
a
@Czar Thank's I'll try that avenue.