Document field name rules
A document can contain user-defined and reserved fields.
User-defined field names can be any non-empty sequence of Unicode characters, with the following exceptions:
-
Field names cannot start with
$. -
Field names cannot be exactly
*. -
If a field name includes
&or., you must escape those characters when you use the field in a filter, sort, projection, or update. For more information, see Work with.and&in field names.
Reserved fields are tied to specific functionality. Include the following reserved fields in your documents, if applicable:
-
_id: An optional unique identifier for the document. If_idis omitted, it is created automatically based on the collection’s ID type. For more information, see Document IDs. -
$vector: An optional array of numbers representing a vector embedding for vector search. The$vectorfield is only supported for vector-enabled collections. A document cannot contain both a$vectorand a$vectorizefield. For more information, see $vector in collections. -
$vectorize: An optional string from which to generate vector embeddings for vector search. The$vectorizefield is only supported for collections that have an embedding provider integration. A document cannot contain both a$vectorand a$vectorizefield. For more information, see $vectorize in collections. -
$lexical: An optional string to make the document searchable for lexicographical matching and the lexical search component of hybrid search. The$lexicalfield is only supported for collections that have lexical search enabled. For more information, see $lexical in collections. -
$hybrid: An optional string that populates both$vectorizeand$lexical. The$hybridshorthand is only supported for collections that have vectorize and lexical search enabled. If a document uses$hybrid, it cannot contain a root-level$vectorizeor$lexicalfield. For more information, see $hybrid in collections.