Search code examples
swiftparse-platformpush-notificationapple-push-notificationsparse-server

Turn off parse push status


Is there anyway to turn off recording or clear all of the _PushStatus class? It is getting very large and I will never need it.

I have already tried: *query from IOS app, the findObjectsInBackgroundWithBlock method gives empty data. *query from cloud code funtion, also empty results


Solution

  • There is no way to turn it off for the moment. You can open a pull request to add that option, or periodically drop the table from your MongoDB database.

    You can put a TTL on a collection right through an index.

    We cap the collection size to objects that are less than a month old, and it's working flawlessly:

    {
      "v": 1,
      "key": {
        "_created_at": 1
      },
      "name": "_created_at_1",
      "ns": "parse-ampme-prod._PushStatus",
      "background": true,
      "expireAfterSeconds": 2592000
    }
    

    You can create such an index using:

    db.["_PushStatus"].createIndex( { "_created_at": 1 }, { expireAfterSeconds: 3600  } );
    

    This will automatically delete all objects that are older than an hour, and you can adapt it to your needs.