Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Access document's fields without using .get/.set #200

Open
LennyPenny opened this issue Dec 6, 2017 · 3 comments
Open

Access document's fields without using .get/.set #200

LennyPenny opened this issue Dec 6, 2017 · 3 comments

Comments

@LennyPenny
Copy link

LennyPenny commented Dec 6, 2017

Is there a plan for this so documents could be used more natively?

i.e.

let user = await User.findOne();

user.name = user.name + " test";

user.save()

I'm not familiar with your current implementation, but it could probably be easily implemented using proxies

@LennyPenny LennyPenny changed the title Acces document's field without using .get/.set Acces document's fields without using .get/.set Dec 6, 2017
@LennyPenny LennyPenny changed the title Acces document's fields without using .get/.set Access document's fields without using .get/.set Dec 6, 2017
@vadimdemedes
Copy link
Owner

Yes, I think it's ok to implement this now since proxies have good Node.js support now.

@LennyPenny
Copy link
Author

LennyPenny commented Jan 20, 2018

Sadly I'm having trouble implementing this because I'm not really familiar with the underlying react stuffs

https://vgy.me/dhLqE8.png

Could you point me in the right direction?

@vadimdemedes
Copy link
Owner

Hm, yeah, I did a little research and I don't think it's possible to implement that feature with a Proxy. Seems there's no clean solution for it. Plus it's not worth all the effort to just save a few chars.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants