Skip to content

Conversation

@ofhouse
Copy link
Member

@ofhouse ofhouse commented Sep 1, 2025

In the current implementation undefined values are filtered out when using ORDER BY clause.
I tested it with the CosmosDB and the official CosmosDB emulator and both return undefined values instead of filtering them out:

I used the following query:
See the code I used here: https://github.com/uncurated-tests/cosmosdb-sortby/blob/main/test.cjs

SELECT c.id, c.config
FROM c
ORDER BY c.config.enabled ASC 

ASC Sorting

[
  { 
    id: 'a',
    config: {}
  },
  {
    id: 'b',
    config: { enabled: false }
  },
  {
    id: 'c',
    config: { enabled: true }
  }
]

DESC Sorting

[
  {
    id: 'df77b86a-b07b-4449-b4c4-e84eda2fd52b',
    config: { enabled: true },
  },
  {
    id: '5509a33a-fc8a-4788-9cc6-da73a7ed09f8',
    config: { enabled: false },
  },
  {
    id: 'f6707be8-b495-48ac-afea-38cc718551ea',
    config: {},
  }
]

Copy link
Member

@matheuss matheuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants