You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently you can only compare fields to constants. This new operator
allows you to compare fields with fields.
For example `playerCount < maxPlayers`
This is an exception to the mongodb syntax as mongodb doesn't support
this without `$expr` which we don't support because it's not JSON
compatible.
---------
Co-authored-by: Koen Bollen <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,10 @@ _It's designed to be simple, secure, and free of dependencies._
7
7
When filtering data based on user-generated inputs, you need a syntax that's both intuitive and reliable. MongoDB's query filter is an excellent choice because it's simple, widely understood, and battle-tested in real-world applications. Although this package doesn't interact with MongoDB, it uses the same syntax to simplify filtering.
- Field comparison: `$field` (see [#difference-with-mongodb](#difference-with-mongodb))
13
14
14
15
This package is intended for use with PostgreSQL drivers like [github.com/lib/pq](https://github.com/lib/pq) and [github.com/jackc/pgx](https://github.com/jackc/pgx). However, it can work with any driver that supports the database/sql package.
(given "customdata" is configured with `filter.WithNestedJSONB("customdata", "password", "playerCount")`)
93
94
94
95
96
+
## Difference with MongoDB
97
+
98
+
- The MongoDB query filters don't have the option to compare fields with each other. This package adds the `$field` operator to compare fields with each other.
- Some comparisons have limitations.`>`, `>=`, `<` and `<=` only work on non-jsob fields if they are numeric.
107
+
108
+
95
109
## Contributing
96
110
97
111
If you have a feature request or discovered a bug, we'd love to hear from you! Please open an issue or submit a pull request. This project adheres to the [Poki Vulnerability Disclosure Policy](https://poki.com/en/c/vulnerability-disclosure-policy).
0 commit comments