neosqlite.index_model module

IndexModel class for PyMongo-compatible index creation.

class neosqlite.index_model.IndexModel(keys: str | list[str] | list[tuple[str, int]], **kwargs: Any)[source]

Bases: object

Create an Index instance.

For use with create_indexes().

Takes either a single key or a list containing (key, direction) pairs or keys. If no direction is given, ASCENDING will be assumed.

Parameters:
  • keys – A single key or a list of (key, direction) pairs or keys.

  • **kwargs – Additional index creation options (unique, sparse, etc.).

__init__(keys: str | list[str] | list[tuple[str, int]], **kwargs: Any)[source]
property document: dict[str, Any]

An index document suitable for passing to the createIndexes command.