Skip to content

Commit f498272

Browse files
committed
Solves #150
Solves #151
1 parent e4c82e8 commit f498272

File tree

5 files changed

+790
-57
lines changed

5 files changed

+790
-57
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,21 @@ async function getRows() {
17911791
});
17921792
}
17931793
```
1794+
__Count__
1795+
Use <i>count</i> on a relation in a filter to compare how many related rows match a condition.
1796+
```javascript
1797+
import map from './map';
1798+
const db = map.sqlite('demo.db');
1799+
1800+
getRows();
1801+
1802+
async function getRows() {
1803+
const rows = await db.order.getMany({
1804+
where: x => x.lines.count().le(1)
1805+
.and(x.lines.count(line => line.product.contains('guitar')).eq(1))
1806+
});
1807+
}
1808+
```
17941809
17951810
</details>
17961811

0 commit comments

Comments
 (0)