Im trying to delete multiple Documents in a collection in my MongoDb database hosted in MongoLab Services via their HTTP interface . Here is the CURL request i'm using in trying to achieve it
curl -H "Content-Type: application/json" -X PUT "https://api.mongolab.com/api/1/databases/mydb/collections/mycoll?q={\"person\":\"554b3d1ae4b0e2832aeeb6af\"}&apiKey=xxxxxxxxxxxxxxxxx"
I essentially want all the documents with the matching query to deleted from the collection .
The Mongolab doc at http://docs.mongolab.com/restapi/#view-edit-delete-document suggests "Specifying an empty list in the body is equivalent to deleting the documents matching the query."
. But how do i send empty list in PUT request body ?
Here is the Golang code im using to achieve the above PUT request
client := &http.Client{}
postRequestToBeSentToMongoLab, err := http.NewRequest("PUT","https://api.mongolab.com/api/1/databases/mydb/collections/mycoll?q={\"person\":\"554b3d1ae4b0e2832aeeb6af\"}&apiKey=xxxxxxxxxxxxxxxxx",nil )
postRequestToBeSentToMongoLab.Header.Set("Content-Type", "application/json") //http://stackoverflow.com/questions/24455147/go-lang-how-send-json-string-in-post-request
responseFromMongoLab, err := client.Do(postRequestToBeSentToMongoLab)
It returns null
is in both the cases (case of PUT request by Golang and CURL ) . How to get this working so that it deletes all documents matching the query ?