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

When selecting both a dereference field and a dotted field with the same name in MongoDB, the dereference field returns NULL #18243

Open
krvikash opened this issue Jul 12, 2023 · 1 comment
Assignees
Labels
bug Something isn't working correctness mongodb MongoDB connector

Comments

@krvikash
Copy link
Contributor

This is a regression after #17710 merge.

    @Test
    public void test2()
    {
        String tableName = "test" + randomNameSuffix();

        Document document = new Document()
                .append("_id", new ObjectId("5126bbf64aed4daf9e2ab771"))
                .append("dotted.field", "foo")
                .append("dotted", new Document("field", "bar"));
        client.getDatabase("test").getCollection(tableName).insertOne(document);

        assertThat(query("SELECT \"dotted.field\", dotted.field FROM test." + tableName))
                .skippingTypesCheck()
                .matches("VALUES (NULL, NULL)");

        assertUpdate("DROP TABLE test." + tableName);
    }

Expected: Dereference field dotted.field should return bar

@krvikash krvikash added bug Something isn't working correctness labels Jul 12, 2023
@krvikash krvikash self-assigned this Jul 12, 2023
@krvikash krvikash added the mongodb MongoDB connector label Jul 12, 2023
@krvikash
Copy link
Contributor Author

Thanks, @findepi for pointing this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctness mongodb MongoDB connector
Development

No branches or pull requests

1 participant