TypeScript Classes vs CB Documents

Hello everyone,

I’m currently using Couchbase CE 4.0 and I’m also developing a (micro-services) application on Node/Seneca.

As we’re mainly a group of C# devs, we’ve decided to go with TypeScript. There are Typings available for CB Node.js SDK 2.1.2 as well as for Seneca so it seemed like a good approach.

However, we’re having some trouble understanding how Classes and Interfaces would relate to Documents on the database and what would be the ideal way of approaching this.
Or am I looking at this wrong and I should define DB documents based on classes?

Does anyone here have any experience with TS and modelling this that would be available to help?

Best Regards.

Hey @celso.santos,

You should be able to define Typescript classes representing your in-database representation, and simply pass this class to the various SDK methods. Keep in mind that Couchbase is not able to represent data-type information, so using interfaces is not directly possible.

Cheers, Brett