Morning all,
Hopefully this is the right place to ask such question but I've been fighting with this issue in MongoDB for quite long and while thinking on moving to Cassandra I was wondering if there's a proper way to do this in here as opposite to what I was trying in MongoDB.
I’ve got a collection named “bookings”, which contain different bookings performed by users:
{
_id: ObjectId("..."),
timestamp: 123456789,
hotel_id: "123456789",
city: "paris",
country: "france",
device: "web",
filters: [
"city=paris",
"country=france",
"device=web",
"city=paris&country=france",
"city=paris&device=web",
"country=france&device=web",
...
],
booking_ref: "ABCD"
}
The part within `filters` is dynamic, some fixed fields are present (such as city) but others may appear or no, such as device which is present in some documents but not in others.
What was done is a list of all possible combinations of filters so it's easily searchable from the API which consumes it and when adding/removing certain filters it's transparent.
Having those filters as attributes of the Document in MongoDB is an issue since those being dynamic deleting/creating indexes everytime a new filterable field was added is no option.
Which would be the way of modelling this in Cassandra so filters are dynamic, easily queryable from the consumer and without a performance impact?
Ps. In case it's not clear enough I can extend with more information!