Package com.mongodb
Enum CursorType
- java.lang.Object
-
- java.lang.Enum<CursorType>
-
- com.mongodb.CursorType
-
- All Implemented Interfaces:
Serializable
,Comparable<CursorType>
public enum CursorType extends Enum<CursorType>
An enumeration of cursor types.- Since:
- 3.0
- MongoDB documentation
- OP_QUERY
-
-
Enum Constant Summary
Enum Constants Enum Constant Description NonTailable
A non-tailable cursor.Tailable
Tailable means the cursor is not closed when the last data is retrieved.TailableAwait
A tailable cursor with a built-in server sleep before returning an empty batch.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
isTailable()
True if the cursor type is tailable.static CursorType
valueOf(String name)
Returns the enum constant of this type with the specified name.static CursorType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NonTailable
public static final CursorType NonTailable
A non-tailable cursor. This is sufficient for a vast majority of uses.
-
Tailable
public static final CursorType Tailable
Tailable means the cursor is not closed when the last data is retrieved. Rather, the cursor marks the final object's position. You can resume using the cursor later, from where it was located, if more data were received. Like any "latent cursor", the cursor may become invalid at some point - for example if the final object it references were deleted.
-
TailableAwait
public static final CursorType TailableAwait
A tailable cursor with a built-in server sleep before returning an empty batch. In most cases this is preferred type of tailable cursor, as it is less resource intensive.
-
-
Method Detail
-
values
public static CursorType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CursorType c : CursorType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CursorType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
isTailable
public abstract boolean isTailable()
True if the cursor type is tailable.- Returns:
- true if the cursor type is tailable
-
-