@@ -163,92 +163,6 @@ describe('Collection', function () {
163163 } ) ;
164164 } ) ;
165165
166- it ( 'should fail to insert due to illegal keys' , function ( done ) {
167- db . createCollection ( 'test_invalid_key_names' , ( err , collection ) => {
168- // Legal inserts
169- collection . insertMany (
170- [ { hello : 'world' } , { hello : { hello : 'world' } } ] ,
171- configuration . writeConcernMax ( ) ,
172- err => {
173- expect ( err ) . to . not . exist ;
174-
175- // Illegal insert for key
176- collection . insertOne ( { $hello : 'world' } , configuration . writeConcernMax ( ) , err => {
177- expect ( err ) . to . be . an . instanceof ( Error ) ;
178- expect ( err . message ) . to . equal ( "key $hello must not start with '$'" ) ;
179-
180- collection . insertOne (
181- { hello : { $hello : 'world' } } ,
182- configuration . writeConcernMax ( ) ,
183- err => {
184- expect ( err ) . to . be . an . instanceof ( Error ) ;
185- expect ( err . message ) . to . equal ( "key $hello must not start with '$'" ) ;
186-
187- collection . insertOne (
188- { he$llo : 'world' } ,
189- configuration . writeConcernMax ( ) ,
190- err => {
191- expect ( err ) . to . not . exist ;
192-
193- collection . insertOne (
194- { hello : { hell$o : 'world' } } ,
195- configuration . writeConcernMax ( ) ,
196- err => {
197- expect ( err ) . to . not . exist ;
198-
199- collection . insertOne (
200- { '.hello' : 'world' } ,
201- configuration . writeConcernMax ( ) ,
202- err => {
203- expect ( err ) . to . be . an . instanceof ( Error ) ;
204- expect ( err . message ) . to . equal ( "key .hello must not contain '.'" ) ;
205-
206- collection . insertOne (
207- { hello : { '.hello' : 'world' } } ,
208- configuration . writeConcernMax ( ) ,
209- err => {
210- expect ( err ) . to . be . an . instanceof ( Error ) ;
211- expect ( err . message ) . to . equal ( "key .hello must not contain '.'" ) ;
212-
213- collection . insertOne (
214- { 'hello.' : 'world' } ,
215- configuration . writeConcernMax ( ) ,
216- err => {
217- expect ( err ) . to . be . an . instanceof ( Error ) ;
218- expect ( err . message ) . to . equal (
219- "key hello. must not contain '.'"
220- ) ;
221-
222- collection . insertOne (
223- { hello : { 'hello.' : 'world' } } ,
224- configuration . writeConcernMax ( ) ,
225- err => {
226- expect ( err ) . to . be . an . instanceof ( Error ) ;
227- expect ( err . message ) . to . equal (
228- "key hello. must not contain '.'"
229- ) ;
230- // Let's close the db
231- done ( ) ;
232- }
233- ) ;
234- }
235- ) ;
236- }
237- ) ;
238- }
239- ) ;
240- }
241- ) ;
242- }
243- ) ;
244- }
245- ) ;
246- } ) ;
247- }
248- ) ;
249- } ) ;
250- } ) ;
251-
252166 it ( 'should permit insert of dot and dollar keys if requested' , function ( ) {
253167 const collection = db . collection ( 'test_invalid_key_names' ) ;
254168 return Promise . all ( [
0 commit comments