New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using ObjectClass throws error upon write in Node.js. #998
Comments
I use it this way
with Car being a string representing the object name |
@vikkio88 not sure I understand... I believe that's the same as my example? Are you using that node without error? If so, what version of node and what version of realm-js? |
Your example
My example
'Car' is wrapped in quote, is a string, not the model object |
I have both of those in my examle... both of them work in React Native, but both of them result in the same error on Node. @vikkio88 Are you running this on Node, or? |
Oh sorry didn't get what you meant, was react native |
Is this a node 7 related thing? I.E. is it because native classes in node are treated unlike regular functions? |
Hi, sorry for the late reply. cheers |
@blagoev Ah, I see. So much of it worked in Node 7 without transpiling I didn't think of that. I know it's a different story for front-end JS, but I'd assume a lot of people doing server-side Node aren't transpiling. Seems like it might be ideal to not require it for a lib like this? |
You could transpile or you could write the above sample with ......
var Car = function Car() {
}
Car.schema = CarSchema;
......... |
I'd think that if the realm-js lib is expected to be transpiled, then even if you can get it to work without transpiling, it'd still be unsafe. Because even a patch version bump could contain a change that no longer works in your setup without transpiliation. Since realm-js supports both React Native and Node, it might be worth considering pre-transpiling the npm releases. Since the newer versions of Node support most of ES6, many Node users may find it ideal to not transpile their projects. |
True. ES6 is in our radar. will move this to a backlog for future consideration |
I'm closing this issue as we no longer support RealmJS < v6. I haven't been able to reproduce the issue on v6 or v10. |
The following works fine on ReactNative, but throws an error in Node.js.
realm-js v1.2.0
Node v7.0.0
Error:
Code:
I have also tried making these changes, but had the same results:
realm.create(Car, {color: 'red'});
class Car extends Realm.Object {};
The text was updated successfully, but these errors were encountered: