neosqlite.collection.query_engine.query_methods module¶
Query methods for the QueryEngine.
- class neosqlite.collection.query_engine.query_methods.QueryMethodsMixin(*args, **kwargs)[source]¶
Bases:
QueryEngineProtocolMixin class providing query methods for QueryEngine.
- count_documents(filter: dict[str, Any], session: ClientSession | None = None) int[source]¶
Return the count of documents that match the given filter.
- Parameters:
filter (dict[str, Any]) – A dictionary specifying the query filter.
session (ClientSession, optional) – A ClientSession for transactions.
- Returns:
The number of documents matching the filter.
- Return type:
int
- estimated_document_count(session: ClientSession | None = None) int[source]¶
Return the estimated number of documents in the collection.
- Parameters:
session (ClientSession, optional) – A ClientSession for transactions.
- Returns:
The estimated number of documents.
- Return type:
int
- distinct(key: str, filter: dict[str, Any] | None = None, session: ClientSession | None = None) list[Any][source]¶
Return a list of distinct values from the specified key in the documents of this collection, optionally filtered by a query.
- Parameters:
key (str) – The field name to extract distinct values from.
filter (dict[str, Any] | None) – An optional query filter to apply to the documents.
session (ClientSession, optional) – A ClientSession for transactions.
- Returns:
A list containing the distinct values from the specified key.
- Return type:
list[Any]
- _abc_impl = <_abc._abc_data object>¶
- _is_protocol = False¶