I have a Reporting application which stores the reports in xml format as recieved from source (XML schema is not defined, it can be any format) and those reports contain some keys and values. Like jobid, setid be keys for 1 type of report and userid, groupId for another type of report etc.
The type of keys that can be referred from the document is determined by the namespaces used in the xml doc. These keys are stored on the basis of namespace used in the xml document. For e.g. If a tag in xml fragment uses namespace= "myspace1", then I have keys A and B for myspace1 stored in another table. It will fetch those keys from that table for this namespace, look for their values in xml doc and store it in another table along with the pointer to this xml document (Id of a record storing complete xml document in a cell).
Use cases:
When the user comes and queries for that key and value, I return the document or a set of documents that are having those key/value pairs.
When the user comes and queries for a certain key and provide a name for xslt (pre stored), I fetch the set of documents fulfilling that criteria and convert that xml to html with the specified xslt.
When the user comes and asks for a particular fragment of a doc then it can fetch a subset from a particular document also.
When the user comes and queries for top x values of a certain key, I return the set of documents that are having top 10 values of that key.
I am using DB2 database for its support of xml along with relational capabilities. That makes easier for me to run xpath expressions and fetch values of keys and also aggregate a set of documents fullfilling a criteria, all on the database side.
Problems:
DB2 stores XML doc of upto 2GB in size.
Retrieval is very slow. If some thing involves many documents, then it takes significant time for things to show up in browser, and the user has to wait.
Can MongoDb help in this case, as it is document oriented?
can I do xml related xpath queries and document transformations on db side?
Or is it ok to use both in such a case?