Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the bug, a null able list does not work #4734

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Jul 1, 2024

  1. Fixed the bug, a null able list does not work

    If there is a nullable list with values, the implementation should check it instead of wrapping the nullable list (even if it has values) into another newly created list by the Criteria class.
    
    if (!filter.ids.isNullOrEmpty()) criteria.and("id").`in`(filter.ids)
    -> {"id" : { "$in" : [["667e8b8af76f17213e4d4280"]]}}
    
    if (!filter.ids.isNullOrEmpty()) criteria.and("id").`in`(filter.ids!!)
    -> {"id" :{ "$in" : ["667e8b8af76f17213e4d4280"]}}
    sikandar authored Jul 1, 2024
    Configuration menu
    Copy the full SHA
    47dc58f View commit details
    Browse the repository at this point in the history
  2. Fixed the criteria in method

    If there is a nullable list with values, the implementation should check it instead of wrapping the nullable list (even if it has values) into another newly created list by the Criteria class.
    
    Existing
    Code: if (!filter.ids.isNullOrEmpty()) criteria.and("id").in(filter.ids) 
    Output: {"id" : { "$in" : [["667e8b8af76f17213e4d4280"]]}} Wrong
    
    Code: if (!filter.ids.isNullOrEmpty()) criteria.and("id").in(filter.ids!!) Required !!
    Output: {"id" :{ "$in" : ["667e8b8af76f17213e4d4280"]}} Correct
    
    After Fix
    Code: if (!filter.ids.isNullOrEmpty()) criteria.and("id").in(filter.ids)  With and Without !!
    Output: {"id" : { "$in" : ["667e8b8af76f17213e4d4280"]}} Correct
    sikandar authored Jul 1, 2024
    Configuration menu
    Copy the full SHA
    232b8a1 View commit details
    Browse the repository at this point in the history
  3. Fixed the bug, a null able list does not work

    If there is a nullable list with values, the implementation should check it instead of wrapping the nullable list (even if it has values) into another newly created list by the Criteria class.
    
    Existing
    Code: if (!filter.ids.isNullOrEmpty()) criteria.and("id").in(filter.ids) 
    Output: {"id" : { "$in" : [["667e8b8af76f17213e4d4280"]]}} Wrong
    
    Code: if (!filter.ids.isNullOrEmpty()) criteria.and("id").in(filter.ids!!) Required !!
    Output: {"id" :{ "$in" : ["667e8b8af76f17213e4d4280"]}} Correct
    
    After Fix
    Code: if (!filter.ids.isNullOrEmpty()) criteria.and("id").in(filter.ids)  With and Without !!
    Output: {"id" : { "$in" : ["667e8b8af76f17213e4d4280"]}} Correct
    
     You have read the Spring Data contribution guidelines.
     You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
     You submit test cases (unit or integration tests) that back your changes.
     You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).
    sikandar authored Jul 1, 2024
    Configuration menu
    Copy the full SHA
    2009044 View commit details
    Browse the repository at this point in the history