2015 is rounding to a close and that means the holiday parties are in full bloom.  With travels and new cities, sometimes discovering that local event or party is not exactly easy.  That is what the Lician Club App allows you to do.  Featuring the trendy spots and VIP guest lists, the application would showcase local events that you may book.  Sitting down with Sebastian Benzian Olsson in the Coffee on Couchbase series, we explore how Couchbase Mobile technology allows for the asynchronous event booking feature to happen through the use of Couchbase Sync Gateway.

When members are invited to a specific club through the mobile app, the Couchbase Admin portal will show the specific detailed profile properties.  The indexing is done through the Couchbase concept of ‘Views’ by creating a Map function while through the Sync Function, it allows for the ability to orchestrate data accordingly to the logic described.

To create a view, we must add the View definition for indexing the documents much like the below:


The MAPBLOCK macro is used to set the map function on the view and is where the method provides the reference to the document we wish to index.  The emitter will emit the particular data to the index.  In the example snippet above, the date of the event is the interest and so we set the index range to be the event date and nil.  You can look at the developer documents on Query and Sorting to understand more on Indexing with MapReduce for JSON documents.

The Couchbase Mobile value for Lician Club is the ability to have a quick time to product resolution that saves engineering resources overall.  The various Channels in the application allow for particular access privileges to the different document databases.  The data naturally populates through a few lines of code in the Sync Function; which provides data migration or data extensions to happen easily without ever changing any infrastructure logics.  See in the video below how this is done:

In our next episode in the Coffee on Couchbase series, we will explore more in depth and see how the Channel feature in the Sync Gateway component allows for data partitioning to happen for your mobile apps.

Posted by William Hoang, Mobile Developer Advocate, Couchbase

William was a Developer Advocate on the Mobile Engineering/Developer Experience team at Couchbase. His love for coffee and code has transcended him into the world of mobile while appreciating the offline in-person experiences. Prior, William worked on the Developer Relations team over at Twitter, BlackBerry, and Microsoft while also having been a Software Embedded GPS engineer at Research In Motion. William graduated from McGill University in Electrical Software Engineering

Leave a reply