Skip to content

Aggregate query with null value returns incorrect results #920

Closed
parse-community/parse-server
#6043
@mtrezza

Description

@mtrezza

Issue Description

An aggregate query with $in that contains a null value does not return the correct results.

Steps to reproduce

This MongoDB query executes fine in the shell:

db.MyCollection.aggregate([
    {
        $match: {
            "language": { "$in": [null, "en"]}
        }
    }
]).pretty()

The query returns documents where the language field is missing or has value null or en.
The same query with the Parse SDK in Javascript does not yield the same results:

const query = new Parse.Query("MyCollection");
const pipeline = {
    "match":{"language":{"$in":[null,"en"]}},
};
const results = await query.aggregate(pipeline);

The query returns only documents where the language field has value en, but not where the field is missing or the the field value is null.

Expected Results

The query with Parse SDK should return the same results as the MongoDB shell query.

Actual Outcome

The query returns only documents where the language field has value en, but not where the field is missing or the the field value is null.

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 3.8.0
    • Operating System: -
    • Hardware: -
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): mLab
  • JS SDK

    • JS SDK version: 2.7.0
    • Application? (Browser, Node, React-Native, etc): -

Logs/Trace

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions