-1

I am new to the MarkLogic database. My use case is:

I am trying to connect to the MarkLogic database using Java client api. I have my JSON documents stored in the database, which has tradingDate ( of type date ) as one of the fields. Now I want to fetch all the documents whose tradingDate is less than a particular date.

Could some one please let me know how to proceed further?

Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
Kiras
  • 69
  • 6
  • 4
    You should include some example code you have already tried. SO in not a free coding service. – Dario Jan 23 '17 at 09:24
  • Kiras has re-asked this question with more detail: http://stackoverflow.com/questions/41850049/extracting-data-from-marklogic-db-using-java-client-api-when-fetching-one-docume – Dave Cassel Jan 25 '17 at 17:07

2 Answers2

0

I would recommend looking into:

  • MLCP export with a transform,
  • or into using something like CORB2

HTH!

grtjn
  • 20,254
  • 1
  • 24
  • 35
0

I have tried the below sample and make it working using the query by example in marklogic:-

val queryMgr = client.newQueryManager();

var rawHandle: StringHandle = new StringHandle

rawHandle.withFormat(Format.JSON).

set("{\"$query\":  {\"tradingDate\": { \"$le\":\""+ date + "\"}, \"$filtered\": true}}");

var querydef: RawQueryByExampleDefinition  = queryMgr.newRawQueryByExampleDefinition(rawHandle);  

querydef.setCollections("Collection Name");

jsonDocMgr.search(querydef, 1);

But do you suggest any more good options to work on?

Kiras
  • 69
  • 6