Couchbase - Using buckets and channels

An absolute newbie to Couchbase and NoSQL, can I ask a quick question?

Considering a scenario where an application is designed to do the 2 things shown below.

1. Vehicle Tracking
   - Dedicated Tracking Devices (There will be multiple devices used by same companies / customer)
2. Worker Tracking
   - Individual Smartphone applications, for attendance logging (There will be multiple devices used by same companies / customer)

Now there are many companies subscribing for one of these services, and some subscribe to both. And then Couchbase has databases, buckets, channels, documents etc. So what would be an optimal way to store the data related to different companies and different applications (Vehicle Tracking, Worker Tracking etc). Separate buckets, channels? If yes then can I have some simple pointers on what would go where? Create application wise buckets? And then what about Customers? Would that be under different channels?

Thanks a ton. I am a SQL guy but suddenly had to come up with a DB design as our NoSQL guy quit abruptly because of some personal reasons. As I am writing this I am doing my reading but too much to assimilate in a short little time. So I thought I could ask for some advice. Thanks once again

For organizational purposes, buckets are more like databases in other systems. Usually you don’t expect to have a large number of these.

Channels are very powerful for separating out access like this. It would be easy to create all channels as something like unique_customer_id+vehicle_id or something like that, as an example. You can see a moderately complex example of channel use in the training app: https://github.com/couchbaselabs/mobile-training-todo/blob/master/sync-gateway-config.json

Hope that helps get you going. If you can post more about estimated numbers that might help.

1 Like

hi,

Thank you so much for the pointers. I was thinking of creating buckets for different applications - because we have 3 applications mainly - one for workers attendance, other for employees and lastly one for vehicle tracking and management. So I was thinking I could make 3 buckets for these and subsequently make channels for different customers? For now everything is in development phase but eventually we could be expecting hundreds of customers (which means that on a daily basis there could be thousands of records coming in).

And thanks a lot for the link, the example config definitely helps. And one little helo if you could - is there any simple example on how I could post a record from a mobile (Android) to a couchbase server and view it? I have already installed couchbase server, the sync gateway and also the cordova plugin for couchbase (couchbase mobile). All these things are in place and seem to be working well. This would be just to get a feel of the offline sync capabilities of couchbase.

Thanks once again for your time. Really appreciate it. I am a total newbie to NoSQL :blush:

Cheers,
M.M

Take a look at the blog post series that start with “Getting Comfortable with Couchbase Mobile”. I haven’t gotten to the Android example yet, but I think you’ll find it useful. Any feedback you can give on issues that need clarification would be helpful, too.

First post: https://blog.couchbase.com/getting-comfortable-with-couchbase-mobile-installing-couchbase-server/