Start a new topic

schedule a daily query

Hello, I need to know how to schedule a daily query to a database. Basically it will erase an element from the database.

Is it posible to do it through Kinvey? Can anyone help me?

Thanks, Yael

Hi @yaelhh‌,

Kinvey handles date/time values in [ISO8601]( format (eg *2014-09-11T20:40:58.694Z*)
Thanks for your quick response.

I fixed what you told me but it still doesn't work.

Which format Date() should have? the field fechaVigencia is 16-Set-2014.

Hi @yaelhh‌,

The mongo operators in your query should not be surrounded by whitespace ("$and", not " $ and ")


I have created the endpoint, but it is not erasing from the database, could you help me?

The idea is to erase the line that matches with: fechaVigencia = today and pago = false

Thanks again.

function onRequest(request, response, modules) {

date= new Date();

modules.collectionAccess.collection("Compra").remove({"fechaVigencia" : {" $gte ": date}, " $and " : {"pago" : {" $gte ": false}}}, function (err, docs) {

if (err) {

logger.error('Query failed: '+ err);

} else {

response.body = docs;





Hi Yael,

The API reference for the collection access module is [here]( You will be able to delete your document with this.

Once you have written your endpoint you can schedule a weekly run using the schedule popover in the business logic editor like this...

![]( "")
Login or Signup to post a comment