Hi, Shiv:

Sorry, but I don't understand the question.

You cannot store a PDF document and JSON document in a single document.

A PDF document is a binary.  A JSON document is a structured tree.

You cannot patch a binary document.  It is a black box without addressable 
structure.

What are the uris for the associated PDF and JSON documents?  How are they 
ingested.


Erik Hennum


________________________________
From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] on behalf of Shiv Shankar 
[shiv.shivshan...@gmail.com]
Sent: Monday, August 22, 2016 11:01 AM
To: general@developer.marklogic.com
Subject: [MarkLogic Dev General] Adding PDF to an existing json document using 
Patch

Hi Erik Hennum

If I go with PUT, it is replacing the entire document,which is not acceptable.

How to add json document+pdf in one document ?

I used below approach
1. Added a PDF as a separate document and tried adding that uri as part of 
PATCH to referring document, but getting message 204

curl  --basic --user  user:pwd -X POST -d@./patch.json \
 -i -H "Content-type: application/json" \
  -H "X-HTTP-Method-Override: PATCH" \
  'http://localbox:9004/LATEST/documents?uri=/test/LW88899'

and patch.json is

{"pathlang": "jsonpath",

  "patch": [

    {

      "insert": {

        "context": "$.parent.childe",

        "position": "last-child",

        "content": {

          "image": "/example/scdhhs_fm_300.pdf"

        }

      }

    }

  ]

}

Message:
Response:
HTTP/1.1 204 Unchanged
Server: MarkLogic
Content-Length: 0
Connection: Keep-Alive
Keep-Alive: timeout=5

_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to