Modeling flight data in couchbase

data_modelling

#1

Hello,

I am relatively new to couchbase and trying it out for my next project.
Just wanted some suggestions around modeling my particular usecase of storing flight information:

  1. first design

    {
    src:
    _id:
    dest:
    date:
    itineraries: [
    {
    flightNo:
    timeofdeparture:
    layoverTime:

    price:
    },
    …similar itineraries(in several hundreds)
    ]
    }

  2. second design -essentially unwinding the itineraries

{
 src:
_id: 
dest:
date:            
flightNo:
timeofdeparture:
layoverTime:
**price:** 
}

…similar itineraries(in several hundreds)

UseCases:

  1. Price will be getting updated quite frequently(roughly every couple of minutes) and new documents will keep getting inserted, so i expect it to be write intensive
  2. selecting itineraries based on their attributes(like price, timeOfDeparture, totalLayover time) ignoring any other parameters(like destination etc, i.e. i want to run queries just against all stored itineraries )

The problem I see is the second one i would need a lot more space for metadata(keys). Does anyone has any suggestions around which would serve my usecases better?


#2

If it is write heavy you might want to go with the referred approach where you break everything into smaller documents.

Have you seen our travel sample application?

We have it for a few of the major SDK languages. Couchbase 4.x ships with a sample dataset with travel information including itineraries.

Might benefit you to have a look.

Let me know if you need anything else.

Best,