Releases: bit-badger/BitBadger.Documents
v3 (RC 2)
Release Candidate 2
- Uses
Field
type for by-field queries (BREAKING)
For by-field queries using RC 1, the functions required three parameters: the field name, an operator, and a value. The query building functions took just the name and operator, and the parameter building functions required just the name and value. Now, there is a Field
type for this criteria, and it incorporates all three items. It has functions to create these easily, and they follow the form of Field.OP(name, value)
. (EX
and NEX
require no value.)
This is a breaking change; what used to be three parameters ("FieldName" EQ 22
) is now a function call (Field.EQ("FieldName", 22)
in C# or (Field.EQ "FieldName" 22)
in F#). Also, though value
is defined as obj
/object
, PostgreSQL only recognizes string values; SQLite allows strings, numbers, and boolean values.
- Adds
RemoveFields*
functions
While the Patch*
functions can be used to update portions of documents (including setting fields to null
), if the calling application has the JSON serializer set to ignore null
values, the null
field is removed from the patch document, so the destination document is not updated. While a full update would replace the document, a better option here is to remove the fields from the document. These functions take an IEnumerable<string>
(C#) or string list
(F#) as their final parameter, and will remove the specified fields from the matching documents (by-ID, by-field for both, by-contains and by-JSON-path for PostgreSQL). (If using .NET 8/C# 12, this is a great place for the new collection syntax [ "Field1", "Field2" ]
.)
Packages are available on NuGet.