abstract class BaseQueryMessage extends RequestMessage
RequestMessage.EncodingMetadata, RequestMessage.OpCode
Modifier and Type | Field and Description |
---|---|
private boolean |
awaitData |
private boolean |
noCursorTimeout |
private int |
numberToReturn |
private boolean |
oplogReplay |
private boolean |
partial |
private int |
skip |
private boolean |
slaveOk |
private boolean |
tailableCursor |
REQUEST_ID
Constructor and Description |
---|
BaseQueryMessage(java.lang.String collectionName,
int skip,
int numberToReturn,
MessageSettings settings) |
Modifier and Type | Method and Description |
---|---|
BaseQueryMessage |
awaitData(boolean awaitData)
Sets if the cursor should await for data.
|
private int |
getCursorFlag() |
boolean |
isAwaitData()
Returns true if the cursor should await for data.
|
boolean |
isNoCursorTimeout()
Returns true if cursor timeout has been turned off.
|
boolean |
isOplogReplay()
Internal replication use only.
|
boolean |
isPartial()
Returns true if can get partial results from a mongos if some shards are down.
|
boolean |
isSlaveOk()
Returns true if set to allowed to query non-primary replica set members.
|
boolean |
isTailableCursor()
Gets whether the cursor is configured to be a tailable cursor.
|
BaseQueryMessage |
noCursorTimeout(boolean noCursorTimeout)
Sets if the cursor timeout should be turned off.
|
BaseQueryMessage |
oplogReplay(boolean oplogReplay)
Internal replication use only.
|
BaseQueryMessage |
partial(boolean partial)
Sets if partial results from a mongos if some shards are down are allowed
|
BaseQueryMessage |
slaveOk(boolean slaveOk)
Sets if allowed to query non-primary replica set members.
|
BaseQueryMessage |
tailableCursor(boolean tailableCursor)
Sets whether the cursor should be a tailable cursor.
|
protected void |
writeQueryPrologue(BsonOutput bsonOutput)
Write the query prologue to the given BSON output.
|
addCollectibleDocument, addDocument, backpatchMessageLength, encode, encodeMessageBody, encodeMessageBodyWithMetadata, encodeWithMetadata, getCodec, getCollectionName, getCurrentGlobalId, getId, getNamespace, getOpCode, getSettings, writeMessagePrologue
private final int skip
private final int numberToReturn
private boolean tailableCursor
private boolean slaveOk
private boolean oplogReplay
private boolean noCursorTimeout
private boolean awaitData
private boolean partial
BaseQueryMessage(java.lang.String collectionName, int skip, int numberToReturn, MessageSettings settings)
public boolean isTailableCursor()
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.
public BaseQueryMessage tailableCursor(boolean tailableCursor)
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.
tailableCursor
- whether the cursor should be a tailable cursor.public boolean isSlaveOk()
public BaseQueryMessage slaveOk(boolean slaveOk)
slaveOk
- true if allowed to query non-primary replica set members.public boolean isOplogReplay()
public BaseQueryMessage oplogReplay(boolean oplogReplay)
oplogReplay
- the oplogReplay valuepublic boolean isNoCursorTimeout()
The server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use.
public BaseQueryMessage noCursorTimeout(boolean noCursorTimeout)
noCursorTimeout
- true if the cursor timeout should be turned off.public boolean isAwaitData()
Use with tailableCursor
. If we are at the end of the data, block for a while rather than returning no data. After a
timeout period, we do return as normal.
public BaseQueryMessage awaitData(boolean awaitData)
Use with tailableCursor
. If we are at the end of the data, block for a while rather than returning no data. After a
timeout period, we do return as normal.
awaitData
- if we should await for datapublic boolean isPartial()
public BaseQueryMessage partial(boolean partial)
partial
- allow partial results from a mongos if some shards are downprivate int getCursorFlag()
protected void writeQueryPrologue(BsonOutput bsonOutput)
bsonOutput
- the BSON output