Skip to content

Fork additions ​

@abedmurrar/objection is a fork of objection.js 3.1.5. This section only documents what the fork adds or changes. For everything else, the guide and the API reference of this site, which come from objection.js, still apply.

Installation ​

sh
npm install @abedmurrar/objection knex

Existing code imports from 'objection'. To keep those imports working, install the fork under that name:

sh
npm install objection@npm:@abedmurrar/objection

Releases are published under npm's latest dist-tag. Prereleases, when there are any, go to next.

Requirements ​

DependencyRequirement
knex3.3 or newer
ajv8.20 or newer (comes as a dependency)
MySQL8.0.17 or newer (tested on 8.4 with the mysql2 driver). MySQL 5.7 and older aren't supported
MariaDB10.6 or newer (tested on 10.6 and 11.4 with the mariadb driver). See MariaDB
SQLite3.35 or newer for batch inserts, 3.25 or newer for window functions
Node.js24 or newer (24 and 26 are tested)

What the fork adds ​

PageSummary
Breaking changesSecurity and behaviour fixes that change what queries do: escaped JSON keys, orWhere grouping, for() checks, unsupported dialects, NULL JSON columns, knex 3.3, MySQL graph concurrency.
MySQLMySQL and MariaDB. JSON field expressions, the whereJson* methods, whereJsonOverlaps(), MySQL casts, batch inserts (also on SQLite), and an fn.* helper for every MySQL 8.4 built-in function.
Expressionseq(), gt(), and(), plus(), ... on ref(), val(), fn() and raw(). Also fn.case(), fn.exists(), fn.excluded(), filtered aggregates, window functions and none().
Joins and model classesModel classes in place of table names, Model.ref() in join callbacks, onJsonPathEquals(), and fixes for raw columns in whereIn() and subqueries in joins.
PerformanceLess work per query than objection.js 3.1.5: shared validators for bound classes, a faster deep clone, cached schema checks, faster parsing of joined rows, hooks without promises and batched graph inserts on MySQL. With benchmarks, also against other ORMs on MySQL.
knex methodsThe knex methods objection didn't have: andHaving*, comment(), hintComment(), using(), finally() and or in joins. How to upsert, and what is left out on purpose.
Ported from ditojs/objectionFixes ported from Jürg Lehni's fork, which publishes the objection package, with links to the original commits.
TypeScriptRelations inferred from relationMappings, results that only contain loaded relations, checked relation expressions, modifiers and Model.ref() columns, typed fn/ref results, and a simpler custom query builder setup.

The changelog lists each change per release. The migration guide has before and after examples for upgrading TypeScript code.

MIT Licensed. Built on objection.js by Sami Koskimäki and its contributors.