@@ -573,7 +573,6 @@ exports.shouldThrowErrorIfSerializingFunctionUnOrdered = {
573
573
test . equal ( null , err ) ;
574
574
575
575
collection . findOne ( { _id :result . ops [ 0 ] . _id } , function ( err , object ) {
576
- console . dir ( object )
577
576
test . equal ( func . toString ( ) , object . z . code ) ;
578
577
test . equal ( 1 , object . i ) ;
579
578
db . close ( ) ;
@@ -1962,3 +1961,131 @@ exports['should correctly insert > 1000 docs using insert and insertMany'] = {
1962
1961
} ) ;
1963
1962
}
1964
1963
}
1964
+
1965
+ exports [ 'should return error on unordered insertMany with multiple unique key constraints' ] = {
1966
+ // Add a tag that our runner can trigger on
1967
+ // in this case we are setting that node needs to be higher than 0.10.X to run
1968
+ metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
1969
+
1970
+ // The actual test we wish to run
1971
+ test : function ( configuration , test ) {
1972
+ var db = configuration . newDbInstance ( configuration . writeConcernMax ( ) , { native_parser :false } )
1973
+ db . open ( function ( err , db ) {
1974
+ // Get collection
1975
+ var col = db . collection ( 'insertManyMultipleWriteErrors' ) ;
1976
+ col . drop ( function ( err , r ) {
1977
+
1978
+ // Create unique index
1979
+ col . createIndex ( { a :1 } , { unique :true } , function ( err , r ) {
1980
+ test . equal ( null , err ) ;
1981
+
1982
+ col . insertMany ( [ { a :1 } , { a :2 } , { a :1 } , { a :3 } , { a :1 } ] , { ordered :false } , function ( err , r ) {
1983
+ test . ok ( err != null ) ;
1984
+ test . ok ( err . writeErrors . length == 2 ) ;
1985
+
1986
+ db . close ( ) ;
1987
+ test . done ( ) ;
1988
+ } ) ;
1989
+ } ) ;
1990
+ } ) ;
1991
+ } ) ;
1992
+ }
1993
+ }
1994
+
1995
+ exports [ 'should return error on unordered insert with multiple unique key constraints' ] = {
1996
+ // Add a tag that our runner can trigger on
1997
+ // in this case we are setting that node needs to be higher than 0.10.X to run
1998
+ metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
1999
+
2000
+ // The actual test we wish to run
2001
+ test : function ( configuration , test ) {
2002
+ var db = configuration . newDbInstance ( configuration . writeConcernMax ( ) , { native_parser :false } )
2003
+ db . open ( function ( err , db ) {
2004
+ // Get collection
2005
+ var col = db . collection ( 'insertManyMultipleWriteErrors1' ) ;
2006
+ col . drop ( function ( err , r ) {
2007
+
2008
+ // Create unique index
2009
+ col . createIndex ( { a :1 } , { unique :true } , function ( err , r ) {
2010
+ test . equal ( null , err ) ;
2011
+
2012
+ col . insert ( [ { a :1 } , { a :2 } , { a :1 } , { a :3 } , { a :1 } ] , { ordered :false } , function ( err , r ) {
2013
+ test . ok ( err != null ) ;
2014
+ test . ok ( err . writeErrors . length == 2 ) ;
2015
+
2016
+ db . close ( ) ;
2017
+ test . done ( ) ;
2018
+ } ) ;
2019
+ } ) ;
2020
+ } ) ;
2021
+ } ) ;
2022
+ }
2023
+ }
2024
+
2025
+ exports [ 'should return error on ordered insertMany with multiple unique key constraints' ] = {
2026
+ // Add a tag that our runner can trigger on
2027
+ // in this case we are setting that node needs to be higher than 0.10.X to run
2028
+ metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
2029
+
2030
+ // The actual test we wish to run
2031
+ test : function ( configuration , test ) {
2032
+ var db = configuration . newDbInstance ( configuration . writeConcernMax ( ) , { native_parser :false } )
2033
+ db . open ( function ( err , db ) {
2034
+ // Get collection
2035
+ var col = db . collection ( 'insertManyMultipleWriteErrors2' ) ;
2036
+ col . drop ( function ( err , r ) {
2037
+
2038
+ // Create unique index
2039
+ col . createIndex ( { a :1 } , { unique :true } , function ( err , r ) {
2040
+ test . equal ( null , err ) ;
2041
+
2042
+ col . insertMany ( [ { a :1 } , { a :2 } , { a :1 } , { a :3 } , { a :1 } ] , { ordered :true } , function ( err , r ) {
2043
+ test . ok ( err != null ) ;
2044
+
2045
+ db . close ( ) ;
2046
+ test . done ( ) ;
2047
+ } ) ;
2048
+ } ) ;
2049
+ } ) ;
2050
+ } ) ;
2051
+ }
2052
+ }
2053
+
2054
+ exports [ 'should return error on ordered insert with multiple unique key constraints' ] = {
2055
+ // Add a tag that our runner can trigger on
2056
+ // in this case we are setting that node needs to be higher than 0.10.X to run
2057
+ metadata : { requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
2058
+
2059
+ // The actual test we wish to run
2060
+ test : function ( configuration , test ) {
2061
+ var db = configuration . newDbInstance ( configuration . writeConcernMax ( ) , { native_parser :false } )
2062
+ db . open ( function ( err , db ) {
2063
+ // Get collection
2064
+ var col = db . collection ( 'insertManyMultipleWriteErrors3' ) ;
2065
+ col . drop ( function ( err , r ) {
2066
+
2067
+ // Create unique index
2068
+ col . createIndex ( { a :1 } , { unique :true } , function ( err , r ) {
2069
+ test . equal ( null , err ) ;
2070
+
2071
+ col . insert ( [ { a :1 } , { a :2 } , { a :1 } , { a :3 } , { a :1 } ] , { ordered :true } , function ( err , r ) {
2072
+ test . ok ( err != null ) ;
2073
+
2074
+ db . close ( ) ;
2075
+ test . done ( ) ;
2076
+ } ) ;
2077
+ } ) ;
2078
+ } ) ;
2079
+ } ) ;
2080
+ }
2081
+ }
2082
+
2083
+
2084
+
2085
+
2086
+
2087
+
2088
+
2089
+
2090
+
2091
+
0 commit comments