Node.js define schema via class


#1

Hi,

I’m pretty new to realm and I’m experimenting a bit. Love the way it works so far.

I currently have the issue that I would like to use my existing class as base for realms scheme. According to the documentation this is currently not possible in node.js only in ReactNative.

At this point, support for defining models via classes is limited. It works in React Native but not in Node.

Question is if there is a timeframe when this will be available or how to circumvent this limitation. I need some custom setters, getters and extra methods.

Btw. I’m using typescript.

Thanks in advance for your help,
Martin


#2

@mrichtsfeld we support base classes and custom getters and setters. The only limitation is that classes need to be defined using ES5 syntax on Node.js and not ES2015 class syntax (so no class keyword). So you can definitely use your own bases classes with user-defined methods and everything. you just need to express it with the old syntax


#3

Thanks for the reply ianward i am also new to it and it helped me in node js web development.


#4

It’d be good if the documentation was clearer on this possibility.