How do I preserve document structure with autoform?


#1

I’m using autoforms to generate forms and then using the document for further processing. I noticed that the insert autoform doc looks like below. Notice that order is nested separately within authentication.

 "auth": {
         "orders": [
             {
                "method": "method-1",
                 "group": "group-1"
             },
             {
                 "method": "method-2"
             }
         ]

Whilst the update document looks like below. Notice that order is now structured as authentication.order and not separately nested within authentication.

$set{
    "auth.orders": [
         {
             "method": "method-1",
             "group": "group-1"
         },
         {
            "method": "method-2",
             "group":  "group-2"
         }
     ],
}

I know that this means exactly the same in terms of mongo, but in my specific case, I’m using the doc generated to do some xml related conversions and parsing during which time, the authentication.order is causing problems. Is there a way to retain the structure in update form exactly like how it is in the insert form?