Reputation: 11
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!
Upvotes: 0
Views: 103
Reputation: 11
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'})
Upvotes: 1