jxmono / crud

:fork_and_knife: CRUD for mono
MIT License
0 stars 1 forks source link

Missing required field: _tp #32

Closed IonicaBizau closed 10 years ago

IonicaBizau commented 10 years ago

I am trying to make an update request and I am getting this error:

Missing required field: _tp

{
    "t": "529379........131e000001",
    "q": {
        "_id": "52fcb65......3ee6b0411e5"
    },
    "d": {
        "field1": [
         ....
        ],
        "a.b": "...",
        "a.c": "...",
        "a.d": "...",
        "e.f.g": "...",
        "e.h.i": "..."
    }
}

Any idea....?

ottiker commented 10 years ago

just check if the _tp field exists in the schema of the template you query.

IonicaBizau commented 10 years ago

I found the answer: I forgot to add "$set" key. :smile:

So, the correct object is:

{
    "t": "529379........131e000001",
    "q": {
        "_id": "52fcb65......3ee6b0411e5"
    },
    "d": {
        "$set": {
            " field1": [
                ...
            ],
            "a.b": "...",
            "a.c": "...",
            "a.d": "...",
            "e.f.g": "...",
            "e.h.i": "..."
        }
    }
}