I
I
Ilya2014-04-20 14:30:26
MongoDB
Ilya, 2014-04-20 14:30:26

Booking service on Node.js + MongoDB. How to store dates for the most convenient search?

Good day!
I am writing a booking service for a narrow b2b niche as a thesis (that is, this is not just a diploma to write and forget, but a project that will be used in an existing business). I will not go into the specifics of the business, but for simplicity, let's say that this is a reservation of places in a hostel network.
I use Node.js and MongoDB for development. This is my first major project in web development in general and using mongo in particular.
Node.js attracted with its structure, flexibility in extension, asynchronous I / O and (to be honest) trendiness. On the question of whether mongo is suitable for this kind of project, I decided not to think about it and took it on faith that it was suitable ("I'll do it as it turns out and then, if anything, I'll redo it as it should").
So. The most non-obvious architectural thing in the back-end turned out to be a booking calendar and search by dates. I can't figure out how to organize the storage of data about places and booked dates in mongodb so that the search for free places in a certain range of dates is performed with the least resources .
I would be glad to hear both answers to the question and general thoughts that could ease the pain in the ass!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeniy_Van, 2014-04-20
@Evgeniy_Van

epoch? IMHO the most convenient date format

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question