@@ -6,9 +6,9 @@ const { expect } = require('chai');
6
6
7
7
describe ( 'Command Monitoring Events - unit/cmap' , function ( ) {
8
8
const commands = [
9
- new Query ( 'admin.$cmd ' , { a : { b : 10 } , $query : { b : 10 } } , { } ) ,
9
+ new Query ( 'admin' , { a : { b : 10 } , $query : { b : 10 } } , { } ) ,
10
10
new Query ( 'hello' , { a : { b : 10 } , $query : { b : 10 } } , { } ) ,
11
- new Msg ( 'admin.$cmd ' , { b : { c : 20 } } , { } ) ,
11
+ new Msg ( 'admin' , { b : { c : 20 } } , { } ) ,
12
12
new Msg ( 'hello' , { b : { c : 20 } } , { } ) ,
13
13
{ ns : 'admin.$cmd' , query : { $query : { a : 16 } } } ,
14
14
{ ns : 'hello there' , f1 : { h : { a : 52 , b : { c : 10 , d : [ 1 , 2 , 3 , 5 ] } } } }
@@ -48,9 +48,8 @@ describe('Command Monitoring Events - unit/cmap', function () {
48
48
49
49
it ( 'should wrap a basic query option' , function ( ) {
50
50
const db = 'test1' ;
51
- const coll = 'testingQuery' ;
52
51
const query = new Query (
53
- `${ db } . ${ coll } ` ,
52
+ `${ db } ` ,
54
53
{
55
54
testCmd : 1 ,
56
55
fizz : 'buzz' ,
@@ -69,9 +68,8 @@ describe('Command Monitoring Events - unit/cmap', function () {
69
68
70
69
it ( 'should upconvert a Query wrapping a command into the corresponding command' , function ( ) {
71
70
const db = 'admin' ;
72
- const coll = '$cmd' ;
73
71
const query = new Query (
74
- `${ db } . ${ coll } ` ,
72
+ `${ db } ` ,
75
73
{
76
74
$query : {
77
75
testCmd : 1 ,
@@ -92,34 +90,5 @@ describe('Command Monitoring Events - unit/cmap', function () {
92
90
expect ( startEvent ) . to . have . property ( 'connectionId' ) . that . is . a ( 'string' ) ;
93
91
expect ( startEvent ) . to . have . property ( 'command' ) . that . deep . equals ( query . query . $query ) ;
94
92
} ) ;
95
-
96
- it ( 'should upconvert a Query wrapping a query into a find command' , function ( ) {
97
- const db = 'test5' ;
98
- const coll = 'testingFindCommand' ;
99
- const query = new Query (
100
- `${ db } .${ coll } ` ,
101
- {
102
- $query : {
103
- testCmd : 1 ,
104
- fizz : 'buzz' ,
105
- star : 'trek'
106
- }
107
- } ,
108
- { }
109
- ) ;
110
-
111
- const startEvent = new CommandStartedEvent ( conn , query ) ;
112
-
113
- expect ( startEvent ) . to . have . property ( 'commandName' , 'find' ) ;
114
- expect ( startEvent ) . to . have . property ( 'databaseName' , db ) ;
115
- expect ( startEvent ) . to . have . property ( 'requestId' , query . requestId ) ;
116
- expect ( startEvent ) . to . have . property ( 'connectionId' ) . that . is . a ( 'string' ) ;
117
- expect ( startEvent ) . to . have . property ( 'command' ) . that . deep . equals ( {
118
- find : coll ,
119
- filter : query . query . $query ,
120
- batchSize : 0 ,
121
- skip : 0
122
- } ) ;
123
- } ) ;
124
93
} ) ;
125
94
} ) ;
0 commit comments