Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB regression: ISODate fields get persisted as strings #2557

Open
mihaitodor opened this issue May 1, 2024 · 0 comments
Open

MongoDB regression: ISODate fields get persisted as strings #2557

mihaitodor opened this issue May 1, 2024 · 0 comments

Comments

@mihaitodor
Copy link
Collaborator

mihaitodor commented May 1, 2024

This issue was introduced in v4.26.0 (commit 9f69258). Steps to reproduce:

> docker run --rm -p27017:27017 --name mongodb -e MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=secret mongo
> docker exec -it mongodb bash
>> mongosh -u mongoadmin -p secret
>>> use food
>>> db.createCollection("fruits")
input:
  generate:
    mapping: |
      root.ts = "2024-04-29T12:34:05".ts_strptime("%Y-%m-%dT%T")
      root.name = "apple"
    count: 1

output:
  mongodb:
    url: mongodb://localhost:27017/?maxPoolSize=3
    username: mongoadmin
    password: secret
    database: food
    collection: fruits
    operation: insert-one
    write_concern:
      w: "majority"
      j: false
      w_timeout: 5s
    upsert: false
    document_map: |
      root = this

Run the above config with Benthos v4.25.0 and then with the current main branch (commit 51d971a) and then execute db.fruits.find() in mongosh. You'll notice that the ts field is different for the two entries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant