goliatone / core.io-data-manager

core.io Data manager module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

importModel: updateOrCreate fails to udpate

goliatone opened this issue · comments

If we have an entity already in the DB and we run a sync we get an error:

ERROR [19:29:58] ├── datamanager  : _importModel.iterate error location.updateOrCreate failed: 
[Error (E_UNKNOWN) Encountered an unexpected error] 
Details:  
    WriteError({
        "code":11000,
        "index":0,
        "errmsg": "E11000 duplicate key error collection: calyx.location index: _id_ dup key: { : \"6\" }",
        "op":{"name":"Innovation Lab","uuid":"242fc2f2e-4b97-49da-a046-efcf9cb2fc5f","code":"NY15-FL4-HIT_LAB","opened":true,"parent":"2","description":"New York City HQ - 4th Floor - Innovation Lab","index":400,"createdAt":"2017-02-07T22:51:19.145Z","updatedAt":"2017-02-07T22:51:19.145Z","_id":"6"}
    })

DataManager does not know what to do with this error.
They will be bubbled up, you should handle them.

The record being processed:
{
    "name":"Innovation Lab",
    "uuid":"242fc2f2e-4b97-49da-a046-efcf9cb2fc5f",
    "code":"NY15-FL4-HIT_LAB",
    "opened":true,
    "parent":"2",
    "description":"New York City HQ - 4th Floor - InnovationLab",
    "index":400,
    "createdAt":"2017-02-07T22:51:19.145Z",
    "updatedAt":"2017-02-07T22:51:19.145Z",
    "id":"6"
}