Questions tagged [mikro-orm]

MikroORM is TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Currently it supports MongoDB, MySQL, PostgreSQL and SQLite databases. It has first class TypeScript support, while staying back compatible with Vanilla JavaScript.

MikroORM is TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns.

Currently it supports MongoDB, MySQL, PostgreSQL and SQLite databases, but more can be supported via custom drivers right now. It has first class TypeScript support, while staying back compatible with Vanilla JavaScript.

https://mikro-orm.io

200 questions
19
votes
3 answers

Validation Error: Using global entity manager instance methods for context specific actions is disallowed

Using MikroORM and getting this error: ValidationError: Using global EntityManager instance methods for context specific actions is disallowed. If you need to work with the global instance's identity map, use `allowGlobalContext` configuration…
13
votes
3 answers

How difficult is it to choose an ORM for Node.js? Or Node.js lacks a mature ORM

I have a production project to develop. It's an e-commerce site. My current stack: Node.js TypeScript PostgreSQL Now I have to choose an ORM for this project. I think I have two options: TypeORM. I've used this ORM before. It's good and stable…
Mike
  • 613
  • 1
  • 10
  • 20
11
votes
1 answer

I want to init mikroConfig to MikroORM with typescript and i got this error message

The error message: Argument of type '{ readonly entities: readonly [typeof Post]; readonly dbName: "lireddit"; readonly type: "postgresql"; readonly debug: boolean; }' is not assignable to parameter of type 'Configuration |…
LansPeti
  • 153
  • 5
6
votes
1 answer

Error: Cannot find module 'src/entities/Post'

so i am creating a graphQL server using type-graph and mikro-orm everything was fine till i got this error that says => Error: Cannot find module 'src/entities/Post' and that module exists as you can see in this picture: folder structure and this is…
John
  • 125
  • 2
  • 7
6
votes
1 answer

NestJS serialization from snake_case to camelCase

I want to achieve automatic serialization/deserialization of JSON request/response body for NestJS controllers, to be precise, automatically convert snake_case request body JSON keys to camelCase received at my controller handler and vice…
5
votes
0 answers

How can I perform a join with a subquery using Mikro-ORM?

So this is the SQL I'm trying to emulate currently. SELECT * FROM direct_messages AS T INNER JOIN (SELECT sender_id, receiver_id, MAX(sent_at) AS sent_at FROM direct_messages WHERE (sender_id = '2' OR sender_id = '3') AND (receiver_id = '3' OR…
5
votes
0 answers

Mikro ORM : What is the best way to upsert a collection

In the following scenario a whole SalesOrder entity is passed in to the server items collection of sales order entity can have new items, removed items and updated items. just persisting the SalesOrder don't work (wont remove or update) this is the…
5
votes
4 answers

Mikro-orm error: password authentication failed for user "postgres"

I'm trying to code along this React GraphQL TypeScript tutorial The project uses MikroOrm to communicate with a PostgreSQL database. I have PostgreSQL(12.4) installed on my Ubuntu 18.04, created a "postgres" user and I can log in to the user and run…
Laaden
  • 53
  • 1
  • 4
4
votes
1 answer

OptionalProps in Mikro-orm

I am trying to work out how to define additional optional properties. import { Entity, PrimaryKey, Property, OptionalProps } from '@mikro-orm/core'; @Entity() export abstract class BaseEntity { [OptionalProps]?: 'createdAt'; @PrimaryKey() …
FireLeopard
  • 314
  • 4
  • 18
4
votes
1 answer

How can I insert an object graph by using MikroORM?

I'm trying to create and update multiple entities (models) at once. I did this in objection ORM by using insertGraph API which actually inserts entity if it has no id and updates if it has id. Is there a similar API in MikroORM? Currently I'm doing…
Sergii Stotskyi
  • 5,134
  • 1
  • 22
  • 21
3
votes
1 answer

Mikro-orm error TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts"

When I execute any command in mikro-orm cli, the following error appears: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for C:\UsersDesktopintegration-list-restrictive-mikro-orm.config.ts Command run: npx mikro-orm…
bloodbag
  • 31
  • 1
3
votes
1 answer

How to use Axios in Nest.js to POST params request?

I am beginner in NestJS and I would like to ask question on how to use Axios in NestJs. But the problem is I keep getting error TypeError: Converting circular structure to JSON I have created an API POST http://localhost:3000/api/create in NestJS…
Rzj EM
  • 63
  • 4
3
votes
1 answer

NestJS for firebase functions: are the start times production-suitable?

There's plenty of articles on how to set up firebase functions with nestjs, and I've been developing this for about a month now on my local machine. Finally, it was time to release. I used a combination of nestjs and mikro orm to handle my server…
plusheen
  • 1,128
  • 1
  • 8
  • 23
3
votes
1 answer

Use EventSubscriber to register Database History in mikroorm

I am fairly new to the concept of LifcycleHooks and EventSubscribers. I am trying to populate a history table that records the changes done on any other table. I have been trying to use EventSubscriber for this: The idea is that on the onFlush event…
3
votes
6 answers

I want to insert with mikro-orm, but it dont find my table :c (TableNotFoundException)

So Console: yarn dev yarn run v1.22.10 $ nodemon dist/index.js [nodemon] 2.0.7 [nodemon] to restart at any time, enter `rs` [nodemon] watching path(s): *.* [nodemon] watching extensions: js,mjs,json [nodemon] starting `node dist/index.js` …
1
2 3
13 14