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

LockProvider for Mongo usingDbTime() #2116

Open
jaquinod opened this issue Aug 28, 2024 · 5 comments
Open

LockProvider for Mongo usingDbTime() #2116

jaquinod opened this issue Aug 28, 2024 · 5 comments

Comments

@jaquinod
Copy link

jaquinod commented Aug 28, 2024

Dears team,

I am using ShedLock with MongoDB.
I had seen that it exists a feature to use db time for Postgres, MySQL, MariaDb, MS SQL, Oracle, DB2, HSQL and H2

=> Could you in the future add this feature for mongo please ? making usingDbTime() available :-)

Many thanks in advance,

Best Regards,
Eddy from France

@lukas-krecan
Copy link
Owner

lukas-krecan commented Aug 29, 2024

Hi, thanks for the proposal. The trouble is that AFAIK, Mongo does not support date arithmetics. In SQL, I can say lock_until = now() + 5 minutes, I don't think it's possible to do this in Mongo, or is it? Without that, I can't implement it.

@jaquinod
Copy link
Author

jaquinod commented Sep 3, 2024 via email

@lukas-krecan
Copy link
Owner

Cool, I will try it

@lukas-krecan
Copy link
Owner

Hi, I looked into that and there is one thing I don't know how to solve. Here, I need to write $lte(lockUntil, NOW) and I dont know how to send NOW from Java. In Mongo console, you can use Date(), but I don't think it's possible to use from Java. There is currentTimestamp function, but it can only be used to set value of a field. Any ideas how to do that? (I haven't used Mongo in years).

@jaquinod
Copy link
Author

jaquinod commented Sep 6, 2024 via email

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

No branches or pull requests

2 participants