pub fn project(doc: &Value, fields: &[Value]) -> ValueExpand description
Select only the specified fields from a document (field projection).
This is similar to SQL’s SELECT col1, col2 or GraphQL’s field selection. Fields are specified as dot-notation strings (e.g. “meta.logins”). Nested fields are reconstructed in the output — selecting “meta.logins” from { name: “Alice”, meta: { logins: 10, role: “admin” } } produces { meta: { logins: 10 } } — only the requested nested field, not the whole parent object.
Fields that don’t exist in the document are silently skipped.