Reputation: 1133
I describe table_name in Oracle to show list of fields. How can I do that in Marklogic to get a list of elements in a document. Thanks in advance.
Oracle: DESCRIBE EMP_DETAILS
Name
EMPLOYEE_ID
JOB_ID
MANAGER_ID
DEPARTMENT_ID
Upvotes: 0
Views: 516
Reputation: 2475
It's definitely not an apples-to-apples comparison, since documents in MarkLogic equate more to rows than tables. But since documents are self-describing, you're right that you can ask for a list of elements in a document. Using XQuery, try this:
doc($uri)//*/name()
That selects all elements, and prints their name. In MarkLogic, that will also show you the names of properties in a JSON document.
But if you really want to do something more like Oracle, with a describe table, you can create views and use good 'ol SQL to describe them.
Upvotes: 5