0

I have shops that should have an open time in its documents

currently I was looking around and I dont know what to store, for example, my shop open time is at 07:00 AM , but Firebase just let me store a timestamp value which also is an entire Date object.

I need to know how to store this type of values since I need to run a cron every 30 minutes to check either if the shops are open or not to send a notification.

I dont know if its a good practice to just store the entire date or how to check if my store is open every day at 08:00 am

The question is something similar than this : How can I store a time value, specifically only hour and minute in Firebase?

SNM
  • 5,625
  • 9
  • 28
  • 77

1 Answers1

1

I think that the timestamp type could fit your requirement since it allows you to store a specific point on the time. Maybe the approach that you should review is the conversion of these values to a readable type.

Specifically for firebase in a context of database design, the most important piece of data in the time-series database is time. The key-value storage and the relation of each metric, could help you to index the events that happen over the time.

If your cron needs to review the timestamp of each event, it would be easy to read if they are indexed by timestamp.

https://firebase.google.com/docs/reference/js/firebase.firestore.Timestamp Is Firestore a good choice for time series data?

Mario
  • 406
  • 2
  • 6