def post(self): title = self.get_argument("title") mongo_url = os.getenv("MONGOLAB_URI", "mongodb://localhost:27017") parsed = urlsplit(mongo_url) db_name = parsed.path[1:] username = parsed.username password = parsed.password client = MongoClient(mongo_url) db = client.heroku_app14400075 spam = db.Spam spamTitles = db.SpamTitles query = helpers.formatQuery(title) for word in query: spam.update({"word": word, "title": title}, {"$inc": {"count": 1}}, upsert=True) spamTitles.update({"titleCount": "count"}, {"$inc": {"count": 1}}, upsert=True)
def post(self): title = self.get_argument("title") mongo_url = os.getenv("MONGOLAB_URI", "mongodb://localhost:27017") parsed = urlsplit(mongo_url) db_name = parsed.path[1:] username = parsed.username password = parsed.password client = MongoClient(mongo_url) db = client.heroku_app14400075 ham = db.Ham hamTitles = db.hamTitles query = helpers.formatQuery(title) for word in query: # add new words to ham histogram, increment the count as well ham.update({"word": word}, {"$inc": {"count": 1}}, upsert=True) hamTitles.update({"titleCount": "count"}, {"$inc": {"count": 1}}, upsert=True) """