Changelog - 2026-11-04
A nullable search field reads back as null when Typesense drops the key
New Feature Behavior ChangeIn one line. Typesense keeps no null, so a document written with null came back without the key and a schema saying string | null rejected every row. A field declared nullable: true now reads back as null.
What changed
nullableflag.field.string('note', { optional: true, nullable: true }), and the same forstrings,number,numbers,boolean,booleansandgeopoint;vectorandiddo not take it. It needsoptional: true;SearchCollectionFactory.definethrows without it. It is never sent to the engine.- Reads fill it.
find,findOne,findById,searchhits andsuggestreturnnullfor a nullable field whose key is absent. A plainoptionalfield stays absent. A value,0,''and an explicitnullare kept. - Writes return the same shape.
create,createAllandupdateByIdreturn documents with the nullable fields filled, so a created document and a found one match. What is sent to the engine does not change. - Types and schemas.
TSearchDocumenttypes the fieldT | null.deriveDocumentSchemagives theselectschema.nullable().default(null), and thecreateandupdateschemas.nullable().optional(). - Selections and passthrough. A field selection (
filter.fields,includeFields) limits the fill to the selected fields; an empty selection sends no include list on either engine. A selection set only throughengineParamsis not seen by the fill, so select withfilter.fields.mode: 'raw'andmultiSearchfill nothing. - Meilisearch. The fill is engine-neutral, so a nullable field always reads as
T | nullthere too: a storednullstaysnull, and a field that was never set also becomesnull.
Who is affected
- Models with an
optionalfield that the application treats asT | null. Addnullable: trueto that field. The flag is opt-in, so no existing model changes until it is set; for a field that turns it on, the read shape changes from "absent" tonull. - Code that called the protected
omitHiddenFieldsAllof a search repository. It had no caller left and is removed; useshapeDocuments, which strips hidden fields too. - Everyone else. No action needed.
Details
typescript
field.string('note', { optional: true, nullable: true }), // read: string | null, never absent
field.string('nickname', { optional: true }), // read: string, or absentA stored null and a field that was never set look the same after a round trip: both come back null. If the two must differ, store a sentinel value. The Typesense guide has the rules.