Represents some row in a table. This is a generic type that represents some (any) table row with any number & types
of columns. All it asks for is that the row be an object with string keys and any values.
This can/will often be used as the "default", or "untyped" generic type when no specific/static type is provided/desired.
(e.g. class Table<Schema extends SomeRow = SomeRow> { ... })
Be careful when using this, as it is untyped and can lead to runtime errors if the row's structure is not as expected.
It can be an effective footgun (especially for tables, which are inherently typed), so it is recommended to use a
more specific type when possible.
That is not to say it does not have its uses, from flexibility, to prototyping, to convenience, to working with
dynamic data, etc. Just be aware of the risks, especially for tables.
Example
consttable = db.table<SomeRow>('my_table');
awaittable.insertOne({ 'lets.you$insert':function () { return'whatever you want' }, });
Overview
Represents some row in a table. This is a generic type that represents some (any) table row with any number & types of columns. All it asks for is that the row be an object with string keys and any values.
Equivalent to SomeDoc for collections.
This can/will often be used as the "default", or "untyped" generic type when no specific/static type is provided/desired. (e.g.
class Table<Schema extends SomeRow = SomeRow> { ... }
)Disclaimer
Be careful when using this, as it is untyped and can lead to runtime errors if the row's structure is not as expected.
It can be an effective footgun (especially for tables, which are inherently typed), so it is recommended to use a more specific type when possible.
That is not to say it does not have its uses, from flexibility, to prototyping, to convenience, to working with dynamic data, etc. Just be aware of the risks, especially for tables.