Skip to main content

Collections

Collections are organizational containers for your memories - like projects or workspaces.
Collections are manual organizational units. You control what goes where.

Why Use Collections?

  • Separate contexts: Keep work, personal, and project memories distinct
  • Targeted search: Search only within relevant collections
  • Access control: Different API keys can have different collection permissions
  • Multi-tenancy: Isolate data for different users or customers

Creating Collections

Collection names are case-insensitive. “Work” and “work” are treated as duplicates.
from nebula import Nebula
nebula = Nebula(api_key="your-api-key")

collection = nebula.create_collection(
    name="Research Papers",
    description="Academic research documents",
    metadata={"category": "academic"}
)

Storing Memories in Collections

Always specify collection_id when storing memories:
nebula.store_memory({
    "collection_id": collection.id,
    "content": "Q4 planning meeting notes",
    "metadata": {"type": "meeting"}
})

Searching Within Collections

# Search specific collection
results = nebula.search(query="deadlines", collection_ids=["Work"])

# Search multiple collections
results = nebula.search(query="notes", collection_ids=["Work", "Personal"])

# Search all accessible collections
results = nebula.search(query="important")
Use collection names for convenience or UUIDs for precision.

Managing Collections

collections = nebula.list_collections(limit=50)
work_collections = nebula.list_collections(name="Work")

Common Patterns

PatternWhen to Use
One collection per userUser-specific memory/context
One collection per projectProject-scoped documentation
One collection per data typeDifferent content types (docs, chats, notes)

Best Practices

  1. Use descriptive names - customer_support not collection_1
  2. Leverage metadata - Store organizational info in collection metadata
  3. Specify collection_ids for targeted searches - Faster, scoped searches
  4. Plan for scale - Consider collection strategy early

Next Steps