Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions source/includes/large-number-note.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. note:: Large Integer Limitations

To query for integers larger than the JavaScript maximum integer size,
wrap the integer in string characters.

For example, to find all documents with a ``number`` value of ``507550989629521900``, use
this query filter:

.. code-block:: javascript

{ "number": "507550989629521900" }
Copy link

@betsybutton betsybutton Apr 10, 2025

Choose a reason for hiding this comment

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

This example doesn't actually work. It's important to mention the need for NumberLong in the example. This is how Compass knows the type to search for. In the example given in the current draft, Compass would interpret the search value as a string, not as a Long (aka large integer).

For example, { restaurant_id: NumberLong(507550989629521900) } would not work, but { restaurant_id: NumberLong("507550989629521900") } would work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, thanks for the clarification! I'll change the example

2 changes: 2 additions & 0 deletions source/query/filter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Set Query Filter
:lightbox:
:alt: Results of applying a query filter

.. include:: /includes/large-number-note.rst

Examples
--------

Expand Down
Loading