def query_message_ids(collection, query_doc, find_one):
    """
    Peform a query for a stored message, returning a tuple of id strings

    :Args:
        | collection (pymongo.Collection): The collection to search
        | query_doc (dict): The MongoDB query to execute
        | find_one (bool): Find one matching document if True, otherwise all matching.
    :Returns:
        | tuple of strings: all ObjectIds of matching documents
    """
    if find_one:
        result = collection.find_one(query_doc)
        if result:
            return str(result["_id"]),
    else:
        return tuple(str(result["_id"]) for result in collection.find(query_doc, {'_id':1}))