Insert sub documents with multiple objects inside a path

Hello gurus,

I am mutating a document which contains sub document with a path like:

    conn.mutate_in("12_34", SD.upsert("strats.905.a"," abcde",  create_parents=True))

    { 
       "strats": {
                  "905": {
                        "a": "abcde"
                        },
                 "9056: {
                     "a": "abcde"
                    }
        }
}

I was able to upsert “905” in the same format that I showed above.

But I am not able to insert “9056” if it doesn’t exist.
What it is trying to do is - It’s trying to overwrite “905” to “9056”.

@sreeharsha27 I am no mean a guru :slight_smile: but trying to understand
You have 2 lines of code as I have below
conn.mutate_in(“12_34”, SD.upsert(“strats.905.a”," abcde", create_parents=True))

conn.mutate_in(“12_34”, SD.upsert(“strats.9056.a”," abcde", create_parents=True))

and its not creating the second path ?

1 Like