akhilesh sabbisetti
akhilesh sabbisetti

Reputation: 151

Patch update operation for json document in MarkLogic using Java API

I am trying to update the property value of JSON document which of datatype date I am using the following function,

DocumentPatchBuilder.replaceValue("date",new Date());

When this patch is applied the date property value is getting stored as String. Is there any way or any other function so that I can update the date value using DocumentPatchBuilder?

Upvotes: 2

Views: 142

Answers (1)

kcoleman
kcoleman

Reputation: 666

A date is not a native JSON data type. What else would you expect it to be represented as besides a string?

If you want to store a date or dateTime in a JSON document and have it be indexable as such by MarkLogic, you need to use one of the date or time formats recognized by XML Schema. See this topic for details:

http://docs.marklogic.com/guide/app-dev/json#id_64992

Upvotes: 4

Related Questions