Page 1 of 1

Updating an array in the database

Posted: Fri Aug 15, 2014 4:50 pm
by Darren Cassidy

I want to update an array in my database with a users ID, for testing purposes i'm trying to just push a string to the array.

When i do it in the tester with,
{"__op":"AddUnique","objects":["user"]}
%% this works perfectly.

When i do it inside of the datasource,
return '{"__op":"AddUnique","objects":["user"]}';
%% this does not work


Updating an array in the database

Posted: Fri Aug 15, 2014 6:28 pm
by Kateryna Grynko

Hi Darren,

Are there any console errors?


Updating an array in the database

Posted: Fri Aug 15, 2014 7:14 pm
by Darren Cassidy

Updating an array in the database

Posted: Fri Aug 15, 2014 8:00 pm
by Kateryna Grynko

Hi Darren,

Please click the request itself, a Network browser tab will be opened. Could you please post screenshots of request and server response?


Updating an array in the database

Posted: Fri Aug 15, 2014 8:39 pm
by Darren Cassidy

Updating an array in the database

Posted: Fri Aug 15, 2014 8:41 pm
by Darren Cassidy

Updating an array in the database

Posted: Fri Aug 15, 2014 9:32 pm
by Darren Cassidy

fixed it!
return {"__op":"AddUnique","objects":[value]};


Updating an array in the database

Posted: Fri Aug 15, 2014 9:36 pm
by Darren Cassidy

So now when a user votes on a post, their ID is added to an array for the respective post.

What would the 'where' clause look like for the Database_Posts_list_service'. The column name of the array in Posts is 'voters'..

thanks!


Updating an array in the database

Posted: Sun Aug 17, 2014 10:10 pm
by Yurii Orishchuk

Hi Darren,

Thanks for your update.

Give us to know if you will have some problem with this issue.

Regards.