@@ -260,3 +260,76 @@ tests.push( { name: "Insert.LargeDocVector",
260
260
doc : docs }
261
261
] } ) ;
262
262
263
+ /*
264
+ * Setup: Create an empty collection and a unique index on a field.
265
+ * Test: Insert documents into collection using sequential int for the indexed
266
+ * field.
267
+ * Notes: Let mongod create missing _id field
268
+ *
269
+ */
270
+ tests . push ( { name : "Insert.UniqueIndex" ,
271
+ tags : [ 'insert' , 'uniqueidx' , 'regression' ] ,
272
+ pre : function ( collection ) {
273
+ var testDB = collection . getDB ( ) ;
274
+ var collName = collection . getName ( ) ;
275
+ collection . drop ( ) ;
276
+ testDB . createCollection ( collName ) ;
277
+ collection . ensureIndex ( { a : 1 } , { unique : true } ) ;
278
+ } ,
279
+ ops : [
280
+ { op : "insert" ,
281
+ doc :
282
+ { a : { "#SEQ_INT" :
283
+ { seq_id : 0 , start : 0 , step : 1 , unique : true } } } }
284
+ ] } ) ;
285
+
286
+ /*
287
+ * Setup: Create an empty collection and a unique compound index on two fields.
288
+ * Test: Insert documents into collection using sequential int for the indexed
289
+ * fields.
290
+ * Notes: Let mongod create missing _id field
291
+ *
292
+ */
293
+ tests . push ( { name : "Insert.UniqueIndexCompound" ,
294
+ tags : [ 'insert' , 'uniqueidx' , 'regression' ] ,
295
+ pre : function ( collection ) {
296
+ var testDB = collection . getDB ( ) ;
297
+ var collName = collection . getName ( ) ;
298
+ collection . drop ( ) ;
299
+ testDB . createCollection ( collName ) ;
300
+ collection . ensureIndex ( { a : 1 , b : 1 } , { unique : true } ) ;
301
+ } ,
302
+ ops : [
303
+ { op : "insert" ,
304
+ doc :
305
+ { a : { "#SEQ_INT" :
306
+ { seq_id : 0 , start : 0 , step : 1 , unique : true } } ,
307
+ b : { "#SEQ_INT" :
308
+ { seq_id : 0 , start : 0 , step : 1 , unique : true } } } }
309
+ ] } ) ;
310
+
311
+ /*
312
+ * Setup: Create an empty collection and a unique compound index on two fields,
313
+ * with different ordering for both the fields.
314
+ * Test: Insert documents into collection using sequential int for the indexed
315
+ * fields.
316
+ * Notes: Let mongod create missing _id field
317
+ *
318
+ */
319
+ tests . push ( { name : "Insert.UniqueIndexCompoundReverse" ,
320
+ tags : [ 'insert' , 'uniqueidx' , 'regression' ] ,
321
+ pre : function ( collection ) {
322
+ var testDB = collection . getDB ( ) ;
323
+ var collName = collection . getName ( ) ;
324
+ collection . drop ( ) ;
325
+ testDB . createCollection ( collName ) ;
326
+ collection . ensureIndex ( { a : 1 , b : - 1 } , { unique : true } ) ;
327
+ } ,
328
+ ops : [
329
+ { op : "insert" ,
330
+ doc :
331
+ { a : { "#SEQ_INT" :
332
+ { seq_id : 0 , start : 0 , step : 1 , unique : true } } ,
333
+ b : { "#SEQ_INT" :
334
+ { seq_id : 0 , start : 0 , step : 1 , unique : true } } } }
335
+ ] } ) ;
0 commit comments