> For the complete documentation index, see [llms.txt](https://docs.medable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.medable.com/cortex-api/scripting/modules-1/db/driver.md).

# Driver

## class db.Driver

```javascript
const { Driver } = require('db.driver')
```

### Driver(objectName)

*Arguments*

* `objectName` { String } The object definition name.

*Returns*

* { Driver } A driver instance.&#x20;

### aggregate(pipeline)

*Arguments*

* `pipeline` { Object\[] } An optional aggrgation pipeline.

*Returns*

* { [AggregationCursor](/cortex-api/scripting/modules-1/db/cursors.md#class-aggregationcursor) }

### count(where)

*Arguments*

* `where` { Object } An optional where filter document.

*Returns*

* { Number } A document count.

### deleteMany(match)

*Arguments*

* `match` { Object } A match filter document.

*Returns*

* { [DeleteManyOperation](/cortex-api/scripting/operations.md#class-deletemanyoperation) }

### deleteOne(match)

*Arguments*

* `match` { Object } A match filter document.

*Returns*

* { [DeleteOperation](/cortex-api/scripting/operations.md#class-deleteoperation) }

### find(where)

*Arguments*

* `where` { Object } An optional where filter document.

*Returns*

* { [QueryCursor](/cortex-api/scripting/modules-1/db/cursors.md#class-querycursor) }

### readOne(where)

*Arguments*

* `where` { Object } A where filter document.

*Returns*

* { [ReadOneOperation](/cortex-api/scripting/operations.md#class-readoneoperation) }

### insertMany(docs)

*Arguments*

* `docs` { Object\[] } An array of documents to insert.

*Returns*

* { [InsertManyOperation](/cortex-api/scripting/operations.md#class-insertmanyoperation) }

### insertOne(doc)

*Arguments*

* `doc` { Object } A document to insert.

*Returns*

* { [InsertOperation](/cortex-api/scripting/operations.md#class-insertoperation) }

### updateOne(match, doc)

*Arguments*

* `match` { Object } A match filter document.
* `doc` { Object } A document to update.

*Returns*

* { [UpdateOperation](/cortex-api/scripting/operations.md#class-updateoperation) }

### updateMany(match, doc)

*Arguments*

* `match` { Object } A match filter document.
* `doc` { Object } A document to update.

*Returns*

* { [UpdateManyOperation](/cortex-api/scripting/operations.md#class-updatemanyoperation) }

### patchOne(match, doc)

*Arguments*

* `match` { Object } A match filter document.
* `doc` { Object } A document to patch.

*Returns*

* { [PatchOperation](/cortex-api/scripting/operations.md#class-patchoperation) }

### patchMany(match, doc)

*Arguments*

* `match` { Object } A match filter document.
* `doc` { Object } A document to patch.

*Returns*

* { [PatchManyOperation](/cortex-api/scripting/operations.md#class-patchmanyoperation) }
