Adam Garbinski
Posts: 0
Joined: Sat Sep 28, 2013 5:33 pm

Problem with changing multiple objects

Hello,
I am trying to do apparently simple thing but it turns out to be pretty complicated.
I need to update the value of one field in collection. This field's type is an array. This field is called PortionArray. I need to set its value to [] because when it is empty, array mappings fail and I got critical JS error during service execution.

I have studied this manual:

https://docs.appery.io/reference#data...

and decided to try following approaches:

1) Use built-in Appery tool:

Image

with this query:
{"$set":{"PortionArray”:[]}}

2) Use this curl command via Terminal on my MAC:

curl -X PUT -H "X-Appery-Database-Id: mydbID" -H "Content-Type: application/json" -d 'operations={"$set":{"PortionArray”:[]}}’ https://api.appery.io/rest/1/db/colle...

where:
mydbID is the ID of my database
myCollection is the name of the collection containing PortionArray field

In the first approach I get "incorrect query" (looks like this option is only for find queries)

In the second approach I get nothing - after entering cURL command on my MAC and pressing ENTER I get no response at all.

So any help before I START TO CHANGE COUPLE OF THOUSAND ROWS MANUALLY appreciated.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Problem with changing multiple objects

Hello Adam,

The "Query" field is used for query parameter "where", so you can't use there parameter "operations"

Adam Garbinski
Posts: 0
Joined: Sat Sep 28, 2013 5:33 pm

Problem with changing multiple objects

Thanks Sergiy
This was my guess too, but any other methods of changing multiple rows at a time?

Please take look at this. It was generated from online curl tool:

Request:

Image

Appery server response:

Image

I am getting this error:

"code": "DBSP007",
"description": "Serialization error"

so the problem is similar to the one in this post: https://getsatisfaction.com/apperyio/...

but I can't figure out how to fix the request.

Please help me to get on the right track to accomplish this burdensome task.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Problem with changing multiple objects

1) You did't set a databaseId parameter (It can't be an empty)
2) You don't need to use quotes symbols in parameters
use preoperations={"$set":{"PortionArray":[]}}/pre
instead of: pre'operations={"$set":{"PortionArray":[]}}'/pre

Do you need to use exactly CURL requests? Could you use simple REST services?

Adam Garbinski
Posts: 0
Joined: Sat Sep 28, 2013 5:33 pm

Problem with changing multiple objects

Hello Sergiy,
1) I did. I have removed it from the screenshot for security reasons.
2) I tried both ways. Result is exactly the same - serialization error.

No I don't need to use CURL request. Honestly I thought of using REST service. I even have found your helpful post on that :) here:

https://getsatisfaction.com/apperyio/...

Unfortunately I already have one UPDATE SERVICE on that database collection so Appery won't let me create another one (this one is used for updating single DB object so probably will not be of much use in this case). Also to be honest I have no idea what will be the result of running this service against all records in my db with $set parameter for one field only - in the worst case scenario erasing all other field values. Therefore I am a bit reluctant to do it, so if you know a secure way to use REST service for this job then please let me know. It would be definitely the easiest way for this.

This is how the service looks like:

Image

Image

Image

Is it enough to add this to the BODY section:

http://prntscr.com/9q25ek

Adam Garbinski
Posts: 0
Joined: Sat Sep 28, 2013 5:33 pm

Problem with changing multiple objects

Any chance for your advice on that Appery?

Adam Garbinski
Posts: 0
Joined: Sat Sep 28, 2013 5:33 pm

Problem with changing multiple objects

Hi Appery,
Any chance that CHANGES IN PRICING will also improve quality of your support?

Why do you keep me waiting where all I need is a simple feedback:

1) no, we will not help you because we do not know how
2) no, we will not help you because we consider it being out of scope
3) yes we can help you but you have to wait for ....

I could move on with my project instead of wondering if I will have to embark myself on dumb kind of job like changing manually hundreds of records.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Problem with changing multiple objects

Hello Adam,

We are working on your issue at the moment and will get back to you with the update as soon as we have any news from our development team.
Also we are sorry that you aren't satisfied with our support. We want to ensure you that we do our best to provide you quality and fast support, but sometimes it takes additional time. Also we suggest to send direct emails to a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a as they are priority to the forum. Forum is the best effort.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Problem with changing multiple objects

Hello Adam,

Please remove {object_id} from the URL of that service. For multiple update service you don't need to use objectId in the request: https://docs.appery.io/reference#data...

Return to “Issues”