@@ -641,7 +641,13 @@ impl Collection {
641641. await ;
642642
643643match results{
644- Ok ( r) =>Ok ( r. 0 ) ,
644+ Ok ( r) =>{
645+ let mut results = r. 0 ;
646+ if results[ "results" ] . is_null ( ) {
647+ results[ "results" ] =json ! ( [ ] ) ;
648+ }
649+ Ok ( results)
650+ }
645651Err ( e) =>match e. as_database_error ( ) {
646652Some ( d) =>{
647653if d. code ( ) ==Some ( Cow :: from ( "XX000" ) ) {
@@ -655,7 +661,11 @@ impl Collection {
655661let results: ( Json , ) = sqlx:: query_as_with ( & built_query, values)
656662. fetch_one ( & pool)
657663. await ?;
658- Ok ( results. 0 )
664+ let mut results = results. 0 ;
665+ if results[ "results" ] . is_null ( ) {
666+ results[ "results" ] =json ! ( [ ] ) ;
667+ }
668+ Ok ( results)
659669} else {
660670Err ( anyhow:: anyhow!( e) )
661671}
@@ -672,7 +682,11 @@ impl Collection {
672682let results: ( Json , ) = sqlx:: query_as_with ( & built_query, values)
673683. fetch_one ( & pool)
674684. await ?;
675- Ok ( results. 0 )
685+ let mut results = results. 0 ;
686+ if results[ "results" ] . is_null ( ) {
687+ results[ "results" ] =json ! ( [ ] ) ;
688+ }
689+ Ok ( results)
676690}
677691
678692#[ instrument( skip( self ) ) ]