Mongo: Unrecognized parameter to $dateToString: timezone

Charlie L 21 Reputation points
2020-07-24T22:18:26.46+00:00

Using the $dateToString Mongo aggregation operator with the optional timezone parameter results in the following error, using Cosmos Mongo with Wire Protocol 3.6:

{"ok": 0.0, "errmsg": "Unrecognized parameter to $dateToString: timezone", "code": 18534, "codeName": "18534"}  

Support for this parameter was introduced in Mongo 3.6. The $dateToString operator is documented as supported by Cosmos's Mongo 3.6 API without any caveats.

Is the lack of support for timezone an oversight? This parameter allows our application to tailor analytics reports to the user's timezone.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,632 questions
{count} votes

Accepted answer
  1. Navtej Singh Saini 4,226 Reputation points Microsoft Employee
    2020-08-04T23:11:29.467+00:00

    @Charlie L

    We contacted our team and the confirmed that the timezone parameter is not supported for dateToString at this time. The document doesn’t go into detail for individual parameters. The Tentative plan to support timezone around the end of the year.

    A workaround is to convert the time zone client-side. Also we will try to add more details to document itself to avoid confusion.

    You can also raise a feedback on Azure Feedback where PG can check it and prioritize new features accordingly.

    Let us know if you need any further help regarding this.

    Thanks
    Navtej S


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.