Anyone help me in this greater than query. i need to find the emp details who’s salary is greater than 20000.I am using mongo db -:

{
    "collection": "emp",
    "query":{
        "salary":{
            "$gt":{
                "salary": 20000
            }
        }
    }
}

i diidnt get any output though i have 5 values in my document which is greater than 20000.
i am not able to find any error. plz help in this thanks in advance

You doubled salary in your JSON query. This should work:

{
    "collection": "emp",
    "query":{
        "salary":{
            "$gt": 20000
        }
    }
}

Thank you so much . It works now :slight_smile: