sjs

MarkLogic - query for documents where a specific json property is not defined

会有一股神秘感。 提交于 2020-01-05 07:13:18
问题 I'm using ML8. I have a bunch of json documents in the database. Some documents have a certain property "summaryData", something like: { ...(other stuff)... summaryData: { count: 100, total: 10000, summaryDate: (date value) } } However, not all documents have this property. I'd like to construct an SJS query to retrieve those documents that don't have this property defined. If it was SQL, I guess the equivalent would be something like "WHERE summaryData IS NULL" I wasn't sure what to search

Implement For Loop in Marklogic Javascript?

落爺英雄遲暮 提交于 2019-12-11 07:55:56
问题 I can get all the URIs of the documents in a collection by using below XQuery: for $doc in fn:collection("transform") return xdmp:node-uri($doc) But, when I tried to implement this in a Javascript module in MarkLogic, it is getting only last document in the database collection. 'use strict'; declareUpdate() var docs = fn.collection("transform"); for(var doc of docs) { xdmp.nodeUri(doc) } It is not giving all the URIs in the collection, but rather it's only returning the last URI of the