John Chaudhry
Posts: 0
Joined: Sun Nov 22, 2015 9:25 am

Using Server Code to update multiple objects

Hi, I have a similar problem:

If I do this in my server code (I have already defined the dbApiKey variable):

var result = Collection.multiUpdateObject(dbApiKey, "CAcol1", '{"end_date":"2017- 03-27"}', {"display":"expired"});

it works fine.

But if I do this:

var result = Collection.multiUpdateObject(dbApiKey, "CAcol1", '{"end_date":{"$lte":"2017-03-27"}', {"display":"expired"});

then I get these error messages in the response section:

"Error code SCSE014: Script execution failed. Details have been added to Trace tab."

and in the Trace tab:

"30.3.2017, 5:45:30 PM: Script Remove_by_end_date_on_test_db: ApperyioAPI: Incorrect query"

As you can see I am using a static date in the query.

Any advice will be appreciated.

Cheers,

John

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

Using Server Code to update multiple objects

Hello John,

Please clarify, what data type do you use in the collection "end_date"? It looks like a string, but it has to be a date to use queries like $lte and so on

John Chaudhry
Posts: 0
Joined: Sun Nov 22, 2015 9:25 am

Using Server Code to update multiple objects

Hi Sergiy,

"end_date" is of type date.

(just double checked)

Cheers,

John

John Chaudhry
Posts: 0
Joined: Sun Nov 22, 2015 9:25 am

Using Server Code to update multiple objects

Found the problem, it needed another } in the query.

Return to “Issues”