our
$VERSION
=
'v0.999.999.6'
;
requires
qw/client bson_codec/
;
sub
_build_result_from_cursor {
my
(
$self
,
$res
) =
@_
;
my
$c
=
$res
->output->{cursor}
or MongoDB::DatabaseError->throw(
message
=>
"no cursor found in command response"
,
result
=>
$res
,
);
my
$batch
=
$c
->{firstBatch};
my
$qr
= MongoDB::QueryResult->_new(
_client
=>
$self
->client,
_address
=>
$res
->address,
_ns
=>
$c
->{ns},
_bson_codec
=>
$self
->bson_codec,
_batch_size
=>
scalar
@$batch
,
_cursor_at
=> 0,
_limit
=> 0,
_cursor_id
=> MongoDB::QueryResult::_pack_cursor_id(
$c
->{id} ),
_cursor_start
=> 0,
_cursor_flags
=> {},
_cursor_num
=>
scalar
@$batch
,
_docs
=>
$batch
,
);
}
sub
_empty_query_result {
my
(
$self
,
$link
) =
@_
;
my
$qr
= MongoDB::QueryResult->_new(
_client
=>
$self
->client,
_address
=>
$link
->address,
_ns
=>
''
,
_bson_codec
=>
$self
->bson_codec,
_batch_size
=> 1,
_cursor_at
=> 0,
_limit
=> 0,
_cursor_id
=> MongoDB::QueryResult::_pack_cursor_id(0),
_cursor_start
=> 0,
_cursor_flags
=> {},
_cursor_num
=> 0,
_docs
=> [],
);
}
1;