Developer
System Administrator
DevOps
Jahia 8.2
How to retrieve all contents having a specific mixin?
Question
I have defined a specific mixin in my definitions (CND file).
How can I retrieve all the nodes (or objects) having this specific mixin?
Answer
You can execute a JCR-SQL2 query, for example:
SELECT * FROM [jmix:accessControlled]
To execute it, you can:
- Use the the JCR query tool: JAHIA_URL/modules/tools/jcrQuery.jsp
- Execute it in a JSP: https://github.com/Jahia/tools/blob/5_1_2/src/main/resources/jcrQuery.jsp
- Execute it in a Java code: https://github.com/Jahia/siteSettings/blob/8_9_0/src/main/java/org/jahia/modules/sitesettings/languages/LanguagesCountAction.java#L49
- Execute through a GraphQL request: https://academy.jahia.com/documentation/jahia-cms/jahia-8.2/developer/working-with-our-apis/graphql-api/using-graphql-to-perform-queries?utm_content=customgpt.ai#queries_1
- Execute the karaf command jcr-query in the page Karaf command line:
jcr:query "SELECT * FROM [jmix:accessControlled]"