I have Xml structures coming like this below. I will have to count the installations on the same date and list them. So I will have to find count by InstallDate and return in XQuery to be used in Marklogic query.
<PcDetail>
<Installations>
<Installation>
<Type>pc</Type>
<purchased>Y</purchased>
<InstallDate>2020-10-01T00:00:00:000Z</InstallDate>
</Installation>
<Installation>
<Type>pc</Type>
<purchased>Y</purchased>
<InstallDate>2020-10-01T00:00:00:000Z</InstallDate>
</Installation>
<Installation>
<Type>pc</Type>
<purchased>Y</purchased>
<InstallDate>2020-10-02T00:00:00:000Z</InstallDate>
</Installation>
<Installation>
<Type>pc</Type>
<purchased>Y</purchased>
<InstallDate>2020-10-02T00:00:00:000Z</InstallDate>
</Installation>
<Installation>
<Type>pc</Type>
<purchased>Y</purchased>
<InstallDate>2020-10-02T00:00:00:000Z</InstallDate>
</Installation>
</Installations>
If you wish to group, count and list the
Installation
by date in MarkLogic server, see belowMarkLogic XQuery dialect
:In a transaction-driven environment, you should utilise MarkLogic performant search engine: