def check_record(self):
        """
        Try to write and read from collection
        """
        result = {
            'state' : 'OK',
            'messages': {
                'info'  : [],
                'error' : [],
                'warn'  : [],
            }
        }

        # Use database test
        db = self.connection['test']

        # Use collection test
        collection = db.test

        # Write new post
        try:
            id = collection.insert({
                'name' : 'John Doe',
                'text' : 'Testing record',
                'date' : datetime.datetime.now()
            })
            result['messages']['info'].append("Inserted record with id %s" % id)
        except Exception as e:
            result['messages']['error'].append("Inserting record into collection failed: %s" % e)
            result['state'] = 'ERROR'
            return result

        # Read our post
        post = collection.find_one()
        if post:
            result['messages']['info'].append("Found our record: %s" % post)
        else:
            result['messages']['error'].append("Inserted record not found!")
            result['state'] = 'ERROR'

        # Empty collection
        try:
            collection.remove()
            result['messages']['info'].append("Deleted everything from collection test")
        except Exception as e:
            result['messages']['error'].append("Can't delete everything from collection test: %s" % e)
            result['state'] = 'ERROR'

        return result
dataset/ETHPy150Open gooddata/smoker/smoker/server/plugins/mongo.py/Plugin.check_record/original