What type should i use to store time length with MongoDB?
I need to store time length of sound data. so Timestamp type doesn't seem right.
What type should i use to store time length with MongoDB?
I need to store time length of sound data. so Timestamp type doesn't seem right.
You should use an integer for that.
MongoDB has two data types especially for timekeeping: Date and Timestamp. But these are meant to represent a specific point in time. They aren't suitable for expressing durations (also, timestamp is for internal use. Users are discouraged from using it).
So your best bet is to convert the duration into milliseconds and store this value in the database.