Q:

How can i remove html tage inside field using mongodb command?

I have a collection Test and data hase stored like this
  {
    "_id": {
        "$oid": "58cba49d689493500be8d0a5"
    },
    "Latitude": 12.96009039,
    "Longitude": 77.55213396,
    "InfoHTML": "<br/>Polling Station No and Name : 131 43 Ward Office (Revenue),B B M P, Room No-01   <br/><br/><a href='http://psleci.nic.in/pslinfoc.aspx?S=S10&A=168&P=131 ' target='_blank'><b>Click here for information<b><\/a>",
    "state": "karnataka",
    "district": "bbmpcentral",
    "constituency": "chamrajpet"
},
{
    "_id": {
        "$oid": "58cba645734d1d2ca8573b20"
    },
    "Latitude": 12.96001673,
    "Longitude": 77.55207344,
    "InfoHTML": "<br/>Polling Station No and Name : 132 43 Ward Office (Revenue),B B M P, Room No-02   <br/><br/><a href='http://psleci.nic.in/pslinfoc.aspx?S=S10&A=168&P=132 ' target='_blank'><b>Click here for information<b><\/a>",
    "state": "karnataka",
    "district": "bbmpcentral",
    "constituency": "chamrajpet"
},
{
    "_id": {
        "$oid": "58cbaa4d734d1d2ca8573c9b"
    },
    "Latitude": 12.96519429,
    "Longitude": 77.58097308,
    "InfoHTML": "<br/>Polling Station No and Name : 11 Abbas Khan Womens College, Darga Compound,   <br/><br/><a href='http://psleci.nic.in/pslinfoc.aspx?S=S10&A=169&P=11 ' target='_blank'><b>Click here for information<b><\/a>",
    "state": "karnataka",
    "district": "bbmpcentral",
    "constituency": "chickpet"
}

if you see InfoHtml field inside the document it contains html tags i want to remove all html tags 
 "InfoHTML": "<br/>Polling Station No and Name : 131 43 Ward Office (Revenue),B B M P, Room No-01   <br/><br/><a href='http://psleci.nic.in/pslinfoc.aspx?S=S10&A=168&P=131 ' target='_blank'><b>Click here for information<b><\/a>"

my expectation i should get InfoHTML in every document like this 
for example i given
"InfoHTML": "Polling Station No and Name : 11 Abbas Khan Womens College, Darga Compound",

is it possible to remove html tags  mongodb.

A:

From your tags, I am assuming that you are using nodejs. In that case, please check out npm package - striptags.
If I had to do whatever you are trying to do, I will do it like this:
var striptags = require('striptags');
var YourCollectionName = require('path-to-your-model');

YourCollectionName.find({}, function (err, docs) {
  if (err) {
    //handle or throw error
  }

  // For all the documents, remove html tags and save
  docs.forEach(function(doc){
    doc.InfoHTML = striptags(doc.InfoHTML);
    doc.save();
  });
});

Hope it helps!

