I’m going to potentially have hundreds of these types of documents (saved as “audit_details_XX”.
How could I write a N1QL query that would find all audit docs that have affected servers in the “mydomain.net” domain?
So in this case, I want find the information nested under the server1.mydomain.net object.
If you think I’ve organized my document in a complicated manner, please let me know. But the idea is that on a given date, a script will be run that will update many servers. I want to capture the output / results of the script in one document. But I also then need to provide a way for users to query update details by server name or location.
All of this is doable without changing your documents or organization. We just need more details. Your document above is not proper JSON. First, you should clarify which things are arrays vs. objects. After that, tell us exactly what questions you want to answer from your data, i.e. which queries you want to run. if you provide the questions in English, we can help translate to N1QL. Hope this helps. -Gerald
Now as far as what I’m after, I would like to query the database using a N1QL query to find all documents that have “server1.mydomain.net” in the list of affected_servers, and be able to display the list of packages for server1.mydomain.net
How would I do that?