-
Notifications
You must be signed in to change notification settings - Fork 4
Database version or last updated time in the API? #8
Comments
It's kinda tricky. I use MongoDB as the database because I didn't want the hassle of writing schemas (aka Mongoose and/or SQL). That means that anything I try import would import (or merge), even if all documents doesn't match structure. So ever since the beginning, I simply use MongoDB doesn't store changed dates, and it only stores created dates and only if you use So yeah, when there are updates, the DB is always "fresh", aka every document has same create date. In that way, it's not possible to have a way of showing when it was modified, in order to create a "latest changes" or something.. idk, I still haven't got a good idea on how implement it on current workflow |
Did some research 1.Using $currentDate 2.Using the System Variable NOW to get the current datetime value. 3.https://stackoverflow.com/a/61227379 Or simply don't store the date for every record. Only store the create date of every "fresh" DB, and make that date avaliable in the API as the database last udpated time. |
I've seen those, but doesn't work in my case: 1: I don't insert documents into DB programatically (aka calling insert()) with an UI or something of the like.. It's quite manual labor actually, I use the CLI 2: Same as above, since 3: That one is the creation date, based on the standard
Maybe that's the thing.. I guess I can make my translation script create a fake collection (of one item, lol) where is the date of the last translation build.
and then use the unix
|
How about calculating checksum of the data? Mongodb has
|
That is awesome and I just did the code to support this but after coding everything and running to test, I was getting For that feature, I'd have to pay M10 dedicated, which is "starting from $0.08/hr".. That would be at least $57.60 if consider 24h for 30days. Not possible. I do have a mongodb installed on the VPS where the apps run because I was testing some stuff, but the lack of a GUI dashboard like Atlas provided made me stick to Atlas. Dang.. |
That's unfortunate. Well, instead of dbHash, I think a similar approach would be calculating the md5 checksum ourselves. So rather than calling dbHash command, the server can instead fetch all the collections and calculate the md5 checksum using nodejs native crypto package. If you are cool or just curious if the above approach work, I can try to whip something up. I'm just wondering if the schema and/or data are available anywhere. |
Can we get a database version or last updated date & time from the API?
So we can cache the data and update it when there is an update.
The text was updated successfully, but these errors were encountered: