QUERY = {id: '1234'} try: record = mongoCollection.find_one(QUERY) if record is None: print 'Add new Record' else: updateResult = mongoCollection.update_one( QUERY, {'$addToSet': {'info': getInfo()}} ) if updateResult['modified_count'] == 1: mongoCollection.update_one( QUERY, {'$inc': {'infoCount': 1}} ) print 'Record exists, updating if needed' except: print 'Failed to add/update'