Couchbase Implementation With Net 5.0

Joker Series: It is a microservices project that I have learned and tried to implement the best approaches. I have decided to write the approaches with examples. Each microservices have own responsible domains. All services are running containers.

Mainly, Joker platform is location based campaign marketplace. Merchants publish own campaigns. User look for campaigns and like campaigns, follow any merchants to get notifications about published campaign.


Couchbase is an award-winning distributed NoSQL cloud database. It delivers unmatched versatility, performance, scalability, and financial value across cloud, on-premises, hybrid, distributed cloud, and edge computing deployments.

Of course I won’t deep dive into Couchbase, I’m not an expert in Couchbase. I’ll give some details.

  • It’s document based NoSQL database.

  • It supports sharding and replication.

  • It’s possible that query documents using N1QL (Nikel). N1QL is closely SQL syntax.

  • Documents are stored JSON or Binary data types.

  • It provide us to key value store, caching, full text search, map reduce views.

  • It provides us SDK for some programming languages such as .NET, Go, Java, Kotlin, Node, Php, Pyhton, Ruby, Scala.

In new versions, There are four organizational layers which are Bucket, Scope, Collection, Document. It allows us to group data hierarchically.

Let’s talk a little about indexes in Couchbase. There are some kind of index types which are Primary, Secondory, Full Text.

  • Primary Index, is based on unique key of documents. It’s used simple queries without any filter.

  • Secondory Index, can be scalar, object or array. It’s used quires with N1QL syntax.

  • Full Text Index, is used searching text in documents.


So!! After the details, let’s go to implement Couchbase to project. :)

I’ve implemented it to Favorite Service, User’s favorite campaign and favorite stores are stored in the service.

Before the implementation, let’s install Couchbase Server. Couchbase will run on container. Firstly, I’ve added the service to docker compose file with simple configuration. It will expose default ports.