0

I want to manipulate a field for a given ID, and the field depends on user Input. So I have...

var fieldName = (got from the user)

r.db('DataBase').table('table').get(ID).update({fieldName: 'YES'})

This doesn't work because RethinkDB doesn't recognize 'fieldName' as a variable, and instead makes a new field called fieldName, instead of the value stored 'fieldName'.

Is there a way around this or no?

Thank you!

1
  • ALRIGHT. I think I got it! Found help here Commented Apr 2, 2016 at 19:40

1 Answer 1

1

Found the way to do it!

Add [] around your variable. This apparently works so far

r.db('DataBase').table('table').get(ID).update({[fieldName]: 'YES'})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.