Given the above structure. I need to delete all records recursively of a test health center (So delete Health center, Household, people) but I cannot figure out a way to get all the records at once of a certain parent, In this case I need to get B and C record for parent A.
The way our data is structured the child knows about the parent hierarchy but not vice versa.
So I can only think of two ways of doing this:
Retrieving all the docs and searching for the parent _id one by one to filter them.
2: The second option would be to selectively filter each level’s doc using the previous parent Id.
Is there an easier way to do this? I found little to no resources on the hierarchical queries. A Mango Query or steps for query would be highly appreciated
It would be nice to have an automated script that does everything for us.
Also, when searching for the resources related to these selectors, if mango query does not give you good results, you can try including terms such as couchdb query or cloudant query.
Hi @kitsao , the links you provided in your solution lead to 404 pages for me. Did they move? I need to display the number of adults and of children on the household overview, and thought it might be easiest to query the DB for persons with the parent set to the id of the household. The support scripts sound like a good source of inspiration for it.
Or is there something I haven’t yet understood about CHT data handling?