arlet-db
Version:
A simple database manager for Node.js
19 lines (17 loc) • 635 B
Markdown
[🏠 Inicio](../README.md)
## countWhere Method
The countWhere method returns the number of rows that match specified criteria in a specified table.
### Syntax
````javascript
async countWhere(tableName, criteria = {})
````
### Parameters
* tableName (String): The name of the table to count rows from.
* criteria (Object): An optional object specifying the criteria for filtering the rows. Defaults to an empty object {}.
### Returns
* The number of rows that match the criteria.
### Example
````javascript
const matchingRows = await db.countWhere('tableName', { column: 'value' });
console.log(matchingRows);
````