Update/upsert/insert nested field using spring mongo repository

Please provide java code to update or upsert or insert nesdted field whether using @query annotation in spring or other way

This documentation for Spring Mongo or perhaps this Spring Mongo Repository doc.

Thanks for the response. In online there is no enough information. If you know the complete answer using mongo compass or spring java, please let me know.

Using the sample_collection1 example from your other thread, convert the following Mongo Shell Update Query to your chosen driver:

// Update the embedded field6
    _id: ObjectId('5e597a2be08a070bab329ef3'),
    field2: {$exists: true}
    $set: {
      'field2.$.field4.0.field6.0': 'updated value'

Reference these docs on Array Update Positional operators:

PS: Same advice from the other thread, next time, show what you tried.


Thanks for your time and patience @007_jb