Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store XML Data in a mongodb collection

Tags:

xml

mongodb

I am still relatively new to NoSQL databases like mongodb, so excuse my ignorance.

Background:

Right now, I have a system that does the following:

  1. gathers system data from clients
  2. outputs that info into an xml document
  3. a perl script takes the data in the xml tags and puts it in a mySQL db.
  4. an apache/php powered website displays the data.

The purpose of this system is to act as an inventory for servers/chassis/network devices/etc.

This has been an okay system, but I have decided to go to a non-relational database because of the advantages I see in using that for the type of data I am storing.

Question:

  1. Is it very simple to extract information from xml documents with mongodb?
  2. Should I rewrite the scripts I have to output a JSON/BSON file instead of XML?
  3. How do you take the information from files and put it into a mongodb database?
like image 943
Jeff Avatar asked May 17 '13 13:05

Jeff


2 Answers

When moving to a NoSQL document DB, the decision is highly influenced by how the data is read or used by the client/user as the data is mostly pre-aggregated/pre-joined based on the usage patterns. So, technically you can move to mongodb "technically" by just converting the data to json/bson instead of xml while importing the data.

like image 160
Aravind Yarram Avatar answered Sep 22 '22 19:09

Aravind Yarram


  1. MongoDB doesn't support xml document. All documents in mongodb are stored in BSON format.
  2. Yes, you can do that.
  3. Mongodb drivers are available for many languages. Use them.
like image 43
vivek Avatar answered Sep 23 '22 19:09

vivek