neode
neode copied to clipboard
Doubts about defining attributes
Very good NPM package I have a little problem. Is there a GET SET method similar to mongoose for defining attributes? Serialization and deserialization are required when dealing with JSON
I have revised your file.
Enabling NPM packages to support GET and SET
I'm not sure if you will add this method.
I put the code on my GitHub first, because my colleague also needs to use this NPM package, so I have to put it on gitHub.
If you mind, I'll delete this NPM package on my gitHub
What are you trying to do?
There is an update method on nodes and relationships to set properties.
const node = neode.find('User', 1);
node.update({ property: 'value' });
In terms of serialising to JSON, you can call toJson on a node or a collection of nodes which will turn the properties and any eager attributes into JSON. Something like this:
neode.all('Movie', params, order , limit, skip)
.then(res => {
/*
*`all` returns a NodeCollection - this has a toJson method that
* will convert all Nodes within the collection into a JSON object
*/
return res.toJson();
})
.then(json => {
res.send(json);
})
https://github.com/adam-cowley/neode-example/blob/master/routes/api.js#L34
Feel free to keep your forked repo. Any PR's are welcome if there are any bugs or features you think are missing.

I want to implement the GET and SET methods that I call when I read and save data. Just like Mongoose @
When I update, I define the type type type of the attribute as integer, but it doesn't work. node.update()
I like this idea. I will see if I can find some time to implement it. If you need it imminently, feel free to submit a PR.