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

Migration to morphia 2.0.x break data retrieval because of timezone assumptions #1504

Closed
ppartarr opened this issue Oct 5, 2020 · 8 comments
Labels
Milestone

Comments

@ppartarr
Copy link

ppartarr commented Oct 5, 2020

Describe the bug
When migrating from Morphia 1.6.x to 2.0.x the data from in Mongo was saved with a UTC timezone and adjusted to local machine date as described in #1218. In Morphia 2.0.x (even with legacy options activated as shown below) the dates are loaded as UTC which causes a mismatch

	MapperOptions mapperOptions = MapperOptions.legacy().build();
	Morphia.createDatastore(mongoClient, dbName, mapperOptions);

To Reproduce
Steps to reproduce the behavior:

  1. Save data to Mongo using Morphia 1.6.x
  2. Migrate to Morphia 2.0.x
  3. Try retrieving data saved with Morphia 1.6.x
  4. Mismatch in timezone assumption breaks retrieval based on date

Expected behavior
I'd expect legacy options in 2.0.x to keep the MapperOptions set to SYSTEM_DEFAULT rather than removing them altogether...

Additional context
Any example models, queries, and executable test cases you can supply will greatly help debugging your issue:

@ppartarr ppartarr added the bug label Oct 5, 2020
@evanchooly
Copy link
Member

OK. So that wasn't as smooth a transition as I'd thought it was going to be. Those can definitely be resurrected.

@evanchooly evanchooly added this to the 2.1.0 milestone Oct 5, 2020
@evanchooly
Copy link
Member

It says 2.1.0 right now but i'll create a 2.0.2 later and back port it.

@ppartarr
Copy link
Author

ppartarr commented Oct 5, 2020

That would be great, thanks! 👍

evanchooly added a commit that referenced this issue Oct 13, 2020
@evanchooly
Copy link
Member

there should be a 2.0.2-SNAPSHOT available if you want to give that a try. This is currently the only 2.0.2 issue but I'm ok with a single fix release if that's what's needed. Otherwise, I'll take stock and see if there's anything else I might backport to 2.0.2 as well.

@ppartarr
Copy link
Author

Thanks for the fix! Could you go ahead with the 2.0.2 release if possible?

@evanchooly
Copy link
Member

You tried it then and it fixes your issue? If so I'll try to get that released today.

@evanchooly
Copy link
Member

Later than intended but I pushed 2.0.2 to central tonight.

@ppartarr
Copy link
Author

Yes I did some quick testing and it looks like the issue is fixed with 2.0.2. Sorry for not getting back to you earlier. Thanks for the release! 😄

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

No branches or pull requests

2 participants