Operation to store, update, or delete an item.

interface PutOperation {
    index?: false | string[];
    key: string;
    namespace: string[];
    value: null | Record<string, any>;
}

Properties

index?: false | string[]

Controls how the item's fields are indexed for search operations.

  • undefined: Uses store's default indexing configuration
  • false: Disables indexing for this item
  • string[]: List of field paths to index

Path syntax supports:

  • Nested fields: "metadata.title"
  • Array access: "chapters[*].content" (each indexed separately)
  • Specific indices: "authors[0].name"

Example

// Index specific fields
index: ["metadata.title", "chapters[*].content"]

// Disable indexing
index: false
key: string

Unique identifier for the document within its namespace. Together with namespace forms the complete path to the item.

Example: If namespace is ["documents", "user123"] and key is "report1", the full path would effectively be "documents/user123/report1"

namespace: string[]

Hierarchical path for the item. Acts as a folder-like structure to organize items. Each element represents one level in the hierarchy.

Example

// Root level documents
namespace: ["documents"]

// User-specific documents
namespace: ["documents", "user123"]

// Nested cache structure
namespace: ["cache", "docs", "v1"]
value: null | Record<string, any>

Data to be stored, or null to delete the item. Must be a JSON-serializable object with string keys. Setting to null signals that the item should be deleted.

Example

{
* field1: "string value",
* field2: 123,
* nested: { can: "contain", any: "serializable data" }
* }