@@ -215,7 +215,7 @@ describe('mongo', function () {
215215 before ( async function ( ) {
216216 db = await MongoClient . connect ( 'mongodb://localhost:27017/local' ) . then ( ( c ) => c . db ( ) ) ;
217217 r1 = new MongoResource ( db , { name : 'Test' , collection : collectionName } ) ;
218- r2 = new MongoResource ( db , { name : 'Other' , collection : collectionName , id : 'myid' , idIsObjectId : false } ) ;
218+ r2 = new MongoResource ( db , { name : 'Other' , collection : collectionName , id : 'myid' , idIsObjectId : false , queryLimit : 5 } ) ;
219219 r3 = new MongoResource ( db , { name : 'Fake' , collection : collectionName } , { '/1' : { get : FakeOp1 } , '/2' : { get : FakeOp2 } } ) ;
220220 r4 = new MongoResource ( db , { name : 'Oid' , collection : collectionName + '_oid' , id : 'myoid' , idIsObjectId : true } ) ;
221221 r5 = new MongoResource ( db , { name : 'Aggregation' , collection : collectionName } , { '/' : { get : Aggregation } } ) ;
@@ -350,7 +350,6 @@ describe('mongo', function () {
350350 } ) ;
351351
352352 it ( 'should create a record with a date preserving its type' , function ( ) {
353- debugger ;
354353 return request
355354 . post ( '/dates' )
356355 . send ( { myid : 'ts' , ts : new Date ( ) } )
@@ -716,6 +715,39 @@ describe('mongo', function () {
716715 } ) ;
717716 } ) ;
718717
718+ it ( 'should return all objects in the collection (6), up to hardcoded limit' , function ( ) {
719+ return request
720+ . get ( '/others' )
721+ . expect ( 200 )
722+ . expect ( 'Content-Type' , / j s o n / )
723+ . expect ( 'Results-Matching' , '7' )
724+ . then ( ( { body : data } ) => {
725+ data . length . should . equal ( 5 ) ;
726+ } ) ;
727+ } ) ;
728+
729+ it ( 'should return all objects in the collection (7), up to the lower of requested and hardcoded limits' , function ( ) {
730+ return request
731+ . get ( '/others?limit=6' )
732+ . expect ( 200 )
733+ . expect ( 'Content-Type' , / j s o n / )
734+ . expect ( 'Results-Matching' , '7' )
735+ . then ( ( { body : data } ) => {
736+ data . length . should . equal ( 5 ) ;
737+ } ) ;
738+ } ) ;
739+
740+ it ( 'should return all objects in the collection (8), up to the lower of requested and hardcoded limits' , function ( ) {
741+ return request
742+ . get ( '/others?limit=4' )
743+ . expect ( 200 )
744+ . expect ( 'Content-Type' , / j s o n / )
745+ . expect ( 'Results-Matching' , '7' )
746+ . then ( ( { body : data } ) => {
747+ data . length . should . equal ( 4 ) ;
748+ } ) ;
749+ } ) ;
750+
719751 it ( 'should return a single attribute of all objects, in ascending order by id (1)' , function ( ) {
720752 return request
721753 . get ( '/tests?fields=y&sort=myid' )
0 commit comments