try {
// force connection to be established
mongoClient.getDatabaseNames();
DBCollection ChangedAttr = db.getCollection(ChangedAttributes);
BasicDBObject newVal = new BasicDBObject("name", comp.getName())
.append("time", System.currentTimeMillis())
.append("op", "changed").append("attribute", attr)
.append("value", newValue).append("oldValue", oldValue);
for (Map.Entry<String, Object> e : comp.getAllProperties()
.entrySet()) {
newVal.append(e.getKey(), e.getValue().toString());
}
ChangedAttr.insert(newVal);
} catch (MongoException e) {
stop();
}
}