docs icon indicating copy to clipboard operation
docs copied to clipboard

Add mLab API method of freeing space

Open cascer1 opened this issue 6 years ago • 4 comments

Instead of throwing everything out, the mLab API can be used to only remove old records. This can be useful if you use reports a lot.

cascer1 avatar Apr 26 '18 11:04 cascer1

Followed the instructions, initially trying to clear out treatments. I generated the following put request(removed confidential bits) but got a "{ "message" : "No Content-Type set, expecting 'application/json'."}"

https://api.mlab.com/api/1/databases/herokudatabasenamehere/collections/treatments?q=%7B%0A%20%20%20%20%22created_at%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22%24regex%22%3A%20%22(2018-0%5B1-9%5D.*)%E2%80%9D%2C%0A%20%20%20%20%20%20%20%20%22%24options%22%3A%20%22g%22%0A%20%20%20%20%7D%0A%7D&apiKey=APIKEYHERE

Also, the other entries example is completely confusing, a brief explanation of the lt field would be useful, unless I'm missing something: { "date": { "$lt": 1516838400000 } }

rhysjones avatar Oct 25 '18 17:10 rhysjones

A little closer, I missed putting [] in the body. Now have this error:

{ "message" : "An unexpected error occurred while attempting to insert objects: Could not parse JSON parameter, please double-check syntax and encoding: {\n "created_at": {\n "$regex": "(2018-0[1-9].)”,\n "$options": "g"\n }\n}: \n{\n "created_at": {\n "$regex": "(2018-0[1-9].)”,\n "$options": "g"\n }\n}\n ^"}

rhysjones avatar Oct 25 '18 17:10 rhysjones

I'm super for this change!!!

tomasboudr avatar Oct 25 '18 17:10 tomasboudr

@rhysjones Could you please post the response you're getting in a code block (surrounded by backticks, or by clicking the <> button in the GitHub comment field) so it's a bit easier to see what's going on?

cascer1 avatar Oct 25 '18 19:10 cascer1