@uql/mongo
Advanced tools
Comparing version 0.4.63 to 0.4.64
{ | ||
"name": "@uql/mongo", | ||
"homepage": "https://uql.io", | ||
"description": "Querier for TypeScript, ES2015+. Supports MySQL, PostgreSQL, MariaDB, MongoDB databases.", | ||
"description": "flexible and efficient ORM, with declarative JSON syntax and smart type-safety", | ||
"license": "MIT", | ||
"version": "0.4.63", | ||
"version": "0.4.64", | ||
"main": "index.js", | ||
@@ -24,3 +24,3 @@ "types": "index.d.ts", | ||
"@types/node": "^16.4.7", | ||
"@uql/core": "^0.4.63", | ||
"@uql/core": "^0.4.64", | ||
"copyfiles": "^2.4.1", | ||
@@ -39,19 +39,22 @@ "rimraf": "^3.0.2", | ||
"keywords": [ | ||
"uql", | ||
"orm", | ||
"data-mapper", | ||
"persistence", | ||
"orm", | ||
"object relational mapper", | ||
"mongo", | ||
"typescript-orm", | ||
"javascript-orm", | ||
"mariadb", | ||
"mariadb-orm", | ||
"mysql", | ||
"mysql-orm", | ||
"postgresql", | ||
"postgresql-orm", | ||
"sqlite", | ||
"sqlite-orm", | ||
"mongodb", | ||
"ts", | ||
"typescript", | ||
"js", | ||
"javascript", | ||
"mongodb-orm", | ||
"entity", | ||
"dao", | ||
"data access object", | ||
"decorator", | ||
"transaction", | ||
"repository", | ||
"service", | ||
"transaction" | ||
"service" | ||
], | ||
@@ -58,0 +61,0 @@ "publishConfig": { |
@@ -17,3 +17,3 @@ # [uql](https://uql.io) · [](https://github.com/impensables/uql/blob/master/LICENSE) [](https://github.com/impensables/uql) [](https://coveralls.io/r/impensables/uql?branch=master) [](https://badge.fury.io/js/%40uql%2Fcore) | ||
- uses the power of `TypeScript` to get (smart) type-safety everywhere. | ||
- the generated queries are efficient, safe, and human-readable. | ||
- the generated queries are performant, safe, and human-readable. | ||
- `$project`, `$filter`, `$sort`, `$limit` works at multiple levels (including deep relations and their fields). | ||
@@ -215,3 +215,3 @@ - declarative and imperative `transactions`. | ||
@Transactional() | ||
async confirmAction(confirmation: Confirmation, @InjectQuerier() querier?: Querier): Promise<void> { | ||
async confirm(confirmation: Confirmation, @InjectQuerier() querier?: Querier): Promise<void> { | ||
if (confirmation.type === 'register') { | ||
@@ -224,3 +224,5 @@ await querier.insertOne(User, { | ||
} else { | ||
await querier.updateOneById(User, confirmation.creatorId, { password: confirmation.password }); | ||
await querier.updateOneById(User, confirmation.creatorId, { | ||
password: confirmation.password, | ||
}); | ||
} | ||
@@ -254,3 +256,3 @@ await querier.updateOneById(Confirmation, confirmation.id, { status: 1 }); | ||
async function confirmAction(confirmation: Confirmation): Promise<void> { | ||
async function confirm(confirmation: Confirmation): Promise<void> { | ||
const querier = await getQuerier(); | ||
@@ -265,3 +267,5 @@ await querier.transaction(async () => { | ||
} else { | ||
await querier.updateOneById(User, confirmation.creatorId, { password: confirmation.password }); | ||
await querier.updateOneById(User, confirmation.creatorId, { | ||
password: confirmation.password, | ||
}); | ||
} | ||
@@ -275,6 +279,6 @@ await querier.updateOneById(Confirmation, confirmation.id, { status: 1 }); | ||
The above code could also be implemented as below (even more granular control): | ||
That ▲ can also be implemented as this ▼ (for more granular control): | ||
```ts | ||
async function confirmAction(confirmation: Confirmation): Promise<void> { | ||
async function confirm(confirmation: Confirmation): Promise<void> { | ||
const querier = await getQuerier(); | ||
@@ -290,3 +294,5 @@ try { | ||
} else { | ||
await querier.updateOneById(User, confirmation.creatorId, { password: confirmation.password }); | ||
await querier.updateOneById(User, confirmation.creatorId, { | ||
password: confirmation.password, | ||
}); | ||
} | ||
@@ -340,3 +346,4 @@ await querier.updateOneById(Confirmation, confirmation.id, { status: 1 }); | ||
// `query` callback allows to extend all then queries that are requested to the API, | ||
// so it is a good place to add additional filters to the queries (like for multi tenant apps). | ||
// so it is a good place to add additional filters to the queries, | ||
// e.g. for multi tenant apps. | ||
query<E>(entity: Type<E>, qm: Query<E>, req: Request): Query<E> { | ||
@@ -343,0 +350,0 @@ qm.$filter = { |
64872
384