Skip to content
This repository has been archived by the owner on Mar 4, 2019. It is now read-only.

Timestamp with time zone issue in field of jsonb body #563

Closed
eduardomourar opened this issue Mar 8, 2018 · 2 comments
Closed

Timestamp with time zone issue in field of jsonb body #563

eduardomourar opened this issue Mar 8, 2018 · 2 comments

Comments

@eduardomourar
Copy link
Contributor

Hello,

I am having an issue with massivejs v2.7.3 while running the following query:

db.example.findDoc({
		"endTimestamp >=": fromDateTime.toDate(),
	},
	{
		order: [
		  {field: "body->>'endTimestamp'", direction: "desc", type: "timestamptz"},
		]
	}, function (err, result) {}
)

I found out that in the code here, the date field is being cast to timestamp. I have the timestamp inside the jsonb body with timezone. When I run this, the time zone is ignored and uses the one from the system, of course.

We should be using timestamptz here instead, right? After doing this change, it works as expected.

Let me know if this makes sense and I will create a PR with this small change.

@eduardomourar eduardomourar changed the title Problem with date with time zone within jsonb body Timestamp with time zone issue in field of jsonb body Mar 8, 2018
@dmfay
Copy link
Owner

dmfay commented Mar 8, 2018

Yeah, a timestamp is appropriate for certain situations but I'm comfortable calling that a bug since almost everyone will expect a timestamptz. Go ahead and make the change (add a test too please!) and I'll cut 2.7.4.

dmfay pushed a commit that referenced this issue Mar 10, 2018
* explicitly using is not comparison

* fix for timestamp casting in docs
@dmfay dmfay closed this as completed in a8c603f Mar 10, 2018
@dmfay
Copy link
Owner

dmfay commented Mar 10, 2018

I've published 2.7.4 on the legacy tag and 4.7.1 on latest. Thanks!

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

No branches or pull requests

2 participants