'Create a new cursor.
Should not be called directly by application developers - see
:meth:`~pymongo.collection.Collection.find` instead.
.. mongodoc:: cursors'

def __init__(self, collection, filter=None, projection=None, skip=0, limit=0, no_cursor_timeout=False, cursor_type=CursorType.NON_TAILABLE, sort=None, allow_partial_results=False, oplog_replay=False, modifiers=None, batch_size=0, manipulate=True, collation=None, hint=None, max_scan=None, max_time_ms=None, max=None, min=None, return_key=False, show_record_id=False, snapshot=False, comment=None):

    self.__id = None
    self.__exhaust = False
    self.__exhaust_mgr = None
    spec = filter
    if (spec is None):
        spec = {}
    validate_is_mapping('filter', spec)
    if (not isinstance(skip, int)):
        raise TypeError('skip    must    be    an    instance    of    int')
    if (not isinstance(limit, int)):
        raise TypeError('limit    must    be    an    instance    of    int')
    validate_boolean('no_cursor_timeout', no_cursor_timeout)
    if (cursor_type not in (CursorType.NON_TAILABLE, CursorType.TAILABLE, CursorType.TAILABLE_AWAIT, CursorType.EXHAUST)):
        raise ValueError('not    a    valid    value    for    cursor_type')
    validate_boolean('allow_partial_results', allow_partial_results)
    validate_boolean('oplog_replay', oplog_replay)
    if (modifiers is not None):
        warnings.warn("the    'modifiers'    parameter    is    deprecated", DeprecationWarning, stacklevel=2)
        validate_is_mapping('modifiers', modifiers)
    if (not isinstance(batch_size, integer_types)):
        raise TypeError('batch_size    must    be    an    integer')
    if (batch_size < 0):
        raise ValueError('batch_size    must    be    >=    0')
    if (projection is not None):
        if (not projection):
            projection = {'_id': 1}
        projection = helpers._fields_list_to_dict(projection, 'projection')
    self.__collection = collection
    self.__spec = spec
    self.__projection = projection
    self.__skip = skip
    self.__limit = limit
    self.__batch_size = batch_size
    self.__modifiers = ((modifiers and modifiers.copy()) or {})
    self.__ordering = ((sort and helpers._index_document(sort)) or None)
    self.__max_scan = max_scan
    self.__explain = False
    self.__comment = comment
    self.__max_time_ms = max_time_ms
    self.__max_await_time_ms = None
    self.__max = max
    self.__min = min
    self.__manipulate = manipulate
    self.__collation = validate_collation_or_none(collation)
    self.__return_key = return_key
    self.__show_record_id = show_record_id
    self.__snapshot = snapshot
    self.__set_hint(hint)
    if (cursor_type == CursorType.EXHAUST):
        if self.__collection.database.client.is_mongos:
            raise InvalidOperation('Exhaust    cursors    are    not    supported    by    mongos')
        if limit:
            raise InvalidOperation("Can't    use    limit    and    exhaust    together.")
        self.__exhaust = True
    self.__empty = False
    self.__data = deque()
    self.__address = None
    self.__retrieved = 0
    self.__killed = False
    self.__codec_options = collection.codec_options
    self.__read_preference = collection.read_preference
    self.__read_concern = collection.read_concern
    self.__query_flags = cursor_type
    if (self.__read_preference != ReadPreference.PRIMARY):
        self.__query_flags |= _QUERY_OPTIONS['slave_okay']
    if no_cursor_timeout:
        self.__query_flags |= _QUERY_OPTIONS['no_timeout']
    if allow_partial_results:
        self.__query_flags |= _QUERY_OPTIONS['partial']
    if oplog_replay:
        self.__query_flags |= _QUERY_OPTIONS['oplog_replay']
