Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/content/docs/d1/worker-api/return-object.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ The methods [`D1PreparedStatement::run`](/d1/worker-api/prepared-statements/#run
success: boolean, // true if the operation was successful, false otherwise
meta: {
served_by: string // the version of Cloudflare's backend Worker that returned the result
served_by_region: string // the region of the database instance that executed the query
served_by_primary: boolean // true if (and only if) the database instance that executed the query was the primary
timings: {
sql_duration_ms: number // the duration of the SQL query execution by the database instance (not including any network time)
}
duration: number, // the duration of the SQL query execution only, in milliseconds
changes: number, // the number of changes made to the database
last_row_id: number, // the last inserted row ID, only applies when the table is defined without the `WITHOUT ROWID` option
Expand All @@ -45,16 +50,21 @@ const stmt = env.DB.prepare("SELECT * FROM Customers WHERE CompanyName = ?").bin
const returnValue = await stmt.run();
return Response.json(returnValue)
```
```js
```json
{
"success": true,
"meta": {
"served_by": "miniflare.db",
"duration": 1,
"served_by_region": "WEUR",
"served_by_primary": true,
"timings": {
"sql_duration_ms": 0.2552
},
"duration": 0.2552,
"changes": 0,
"last_row_id": 0,
"changed_db": false,
"size_after": 8192,
"size_after": 16384,
"rows_read": 4,
"rows_written": 0
},
Expand Down
Loading