This repository was archived by the owner on Sep 2, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -358,7 +358,7 @@ class Service extends AdapterService {
358358
359359 _selectQuery ( q , $select ) {
360360 if ( $select && Array . isArray ( $select ) ) {
361- const items = $select . concat ( `${ this . Model . tableName } .${ this . id } ` ) ;
361+ const items = $select . concat ( Array . isArray ( this . id ) ? this . id . map ( el => { return ` ${ this . Model . tableName } . ${ el } ` ; } ) : `${ this . Model . tableName } .${ this . id } ` ) ;
362362
363363 for ( const [ key , item ] of Object . entries ( items ) ) {
364364 const matches = item . match ( / ^ r e f \( ( .+ ) \) ( a s ( .+ ) ) ? $ / ) ;
Original file line number Diff line number Diff line change @@ -619,6 +619,20 @@ describe('Feathers Objection Service', () => {
619619 } ) ;
620620 } ) ;
621621 } ) ;
622+
623+ it ( 'allows get queries with $select' , ( ) => {
624+ return peopleRooms . get ( [ 2 , 2 ] , { query : { $select : [ 'admin' ] } } ) . then ( data => {
625+ expect ( data . admin ) . to . equal ( 1 ) ;
626+ } ) ;
627+ } ) ;
628+
629+ it ( 'allows find queries with $select' , ( ) => {
630+ return peopleRooms . find ( { query : { roomId : 2 , $select : [ 'admin' ] } } ) . then ( data => {
631+ expect ( data . length ) . to . equal ( 2 ) ;
632+ expect ( data [ 0 ] . admin ) . to . equal ( 0 ) ;
633+ expect ( data [ 1 ] . admin ) . to . equal ( 1 ) ;
634+ } ) ;
635+ } ) ;
622636 } ) ;
623637
624638 describe ( 'Eager queries' , ( ) => {
You can’t perform that action at this time.
0 commit comments