Skip to content

Lightblue skips timezone transformation in case of nested JSON update #818

@kusha

Description

@kusha

For example, I have the following data structure (tested with the MongoDB controller):

{
  "key1": {
    "key2": "... any timestamp ..."
  }
}

... and LightBlue returns -5 timezone (default at the server, non-UTC) in find queries by default.

Correct behavior

If I'm updating the item with the following query and UTC time:

{
  "objectType": "...",
  "version": "...",
  "query": {
    ... select the item above ...
  },
  "update": {
    "$set": {
      "key1.key2": "20171214T00:19:40.000-0000"
    }
  },
  "projection": [
    {
      "field": "key1",
      "include": true,
      "recursive": true
    }
  ]
}

I'm receiving the time transformed to the -5 timezone (non-UTC, as in the find query) in the projection:

{
  "_id": "... any id ...",
  "key1": {
    "key2": "20171213T19:19:40.000-0500"
  }
}

Incorrect behavior

If I'm updating the time value with the following request (please, note the nested JSON):

{
  "objectType": "...",
  "version": "...",
  "query": {
    ... select the item above ...
  },
  "update": {
    "$set": {
      "key1": {
        "key2": "20171214T00:19:40.000-0000"
      }
    }
  },
  "projection": [
    {
      "field": "key1",
      "include": true,
      "recursive": true
    }
  ]
}

I'm receiving the UTC timezone in the projection as provided in the query (UTC, without any transformation):

{
  "_id": "... any id ...",
  "key1": {
    "key2": "20171214T00:19:40.000-0000"
  }
}

Can you, please, confirm, that such behavior isn't expected?
In some cases, I'm updating nested structures and it isn't a good idea to pop the time leafs in the query. How we can fix or workaround that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions