Last active
February 7, 2022 10:40
-
-
Save bsitruk/11db7db11253fb44cbaf176ebcf690c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCurrentDateP(mongoConnection) { | |
const query = { _id: 1 }; | |
const update = { $currentDate: { updated_at: true } }; | |
const queryOptions = { upsert: true, returnOriginal: false }; | |
return mongoConnection | |
.collection('current_date') | |
.findOneAndUpdate(query, update, queryOptions) | |
.then(mongoResult => mongoResult.value.updated_at) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment