Collection Module Documentation

class gsheetquery.collection.Collection(worksheet: Worksheet)

A class representing a collection. This is the equivalent of a single sheet.

find_many(template: Dict[str, str] | None = None, max: int = 0) List[Dict[str, str]]

Returns up to max matching documents as in find_one.

Parameters:
  • template – A list of mappings to strings

  • max – The max number of results to return. If 0, returns all.

find_one(template: Dict[str, str] | None = None) Dict[str, str] | None

Returns the first document matching the given template. The template is a subset of the values of the document. Returns None if no matches found.

Parameters:

template – A list of mappings to strings

insert_many(docs: List[Dict[str, str]])

Insert multiple document into the collection.

Parameters:

docs – A list of mappings of strings

insert_one(doc: Dict[str, str])

Insert one document into the collection.

Parameters:

doc – A mapping of strings