MongoDB/Op/_RenameCollection.pm

filter: Statementstmt 80.6% 25 / 31 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 1 totaltotal 76.1% 32 / 42 CC 2 SCAR 7.5
CC
2
Cov
76%
execute
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.1
« MongoDB/Op/_DropDatabase.pm ↑ Summary MongoDB/DBRef.pm »
1 # Copyright 2016 - present MongoDB, Inc.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14  
15 59 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 59 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 package MongoDB::Op::_RenameCollection;
18  
19 # Implements a collection move/rename; returns a MongoDB::CommandResult
20  
21 59 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 59 our $VERSION = 'v2.2.2';
23  
24 59 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 59 ▶use MongoDB::Op::_Command;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 59 ▶use Types::Standard qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
28 Str
29 59 );
30  
31 59 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 59 has [ 'src_ns', 'dst_ns' ] => (
34 is => 'ro',
35 required => 1,
36 isa => Str,
37 );
38  
39 59 with $_ for qw(
40 MongoDB::Role::_PrivateConstructor
41 MongoDB::Role::_DatabaseOp
42 MongoDB::Role::_WriteOp
43 );
44  
45 0 ▶sub execute {
Subroutine execute: not called CC=2 SCAR=17.9
Pod undocumented
46 0 my ( $self, $link ) = @_;
47  
48 my $op = MongoDB::Op::_Command->_new(
49 db_name => 'admin', # special for this command -- not the db_name attribute
50 query => [
51 renameCollection => $self->src_ns,
52 to => $self->dst_ns,
53 0 ▶ ( $link->supports_helper_write_concern ? ( @{ $self->write_concern->as_args } ) : () ),
Branch: 1 branch
BranchTrueFalseTotal
$link->supports_helper_write_concern ? : 0 0 0
54 ],
55 query_flags => {},
56 bson_codec => $self->bson_codec,
57 session => $self->session,
58 monitoring_callback => $self->monitoring_callback,
59 );
60  
61 0 my $res = $op->execute($link);
62 0 $res->assert_no_write_concern_error;
63  
64 0 return $res;
65 }
66  
67 59 1;
« MongoDB/Op/_DropDatabase.pm ↑ Summary MongoDB/DBRef.pm »