I want to import images into mongoDB along with any dictionary. The dictionary should contain image tags, of which types, numbers and names that I cannot know, at the moment I am defining a scheme. I try to add a dictionary on eve without success:
curl -F"attr={\"a\":1}" -F "img_id=2asdasdasd" -F " img_data=@c :\path\ 1.png;type=image/png" http://127.0.0.1:5000/images {"_status": "ERR", "_issues": {"attr": "must be of dict type"}, "_error": {"message": "Insertion failure: 1 document(s) contain(s) error(s)", "code": 422}}
My schema definition is as follows:
'schema': {
Is it possible at all? Should the schema be fixed for dicts?
EDIT I wanted to add an image and a dictionary after it first, but get an error message in the PATCH request:
C:\Windows\SysWOW64>curl -X PATCH -i -H "Content-Type: application/json" -d "{\ "img_id\":\"asdasdasd\", \"attr\": {\"a\": 1}}" http://localhost:5000/images/asd asdasd HTTP/1.0 405 METHOD NOT ALLOWED Content-Type: application/json Content-Length: 106 Server: Eve/0.7.4 Werkzeug/0.9.4 Python/2.7.3 Date: Wed, 28 Jun 2017 22:55:54 GMT {"_status": "ERR", "_error": {"message": "The method is not allowed for the requested URL.", "code": 405}}
source share