I want to active online archiving with a custom criteria, with this json I get an error

{
“$and”: [
{ “Result”: { “$ne”: null } },
{ “CreationDate”: { “$lte”: new Date(new Date().getTime() - 1000 * 3600 * 24 * 365) } }
]
}

This query is not valid JSON. Please check your syntax and ensure all keys in the JSON object are enclosed in double quotes.

any help?

4 months later

As the error suggests, you need to have double quotes around all the values.
Moreover, this wont work “{ “CreationDate”: { “$lte”: new Date(new Date().getTime() - 1000 * 3600 * 24 * 365) } }”

You need to use the correct syntax, something like below

{ "$and": [ { "Result": { "$ne": "null" } }, { "$lte": [ "$CreationDate", { "$subtract": [ "$$NOW", 31536000000 ] } ] } ] }

Refer to our documentation here