Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mikro-orm

Package Overview
Dependencies
Maintainers
1
Versions
3403
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mikro-orm - npm Package Compare versions

Comparing version 0.7.2 to 0.7.3

10

dist/Collection.js

@@ -25,2 +25,3 @@ "use strict";

const cond = {};
const order = [];
if (this.property.reference === BaseEntity_1.ReferenceType.ONE_TO_MANY) {

@@ -31,3 +32,4 @@ cond[this.property.fk] = this.owner._id;

if (this.property.owner) {
cond._id = { $in: this.items.map(item => item._id) };
const order = this.items.map(item => item._id);
cond._id = { $in: order };
}

@@ -41,2 +43,8 @@ else {

const items = await em.find(this.property.type, cond);
// re-order items when searching with `$in` operator
if (this.property.reference === BaseEntity_1.ReferenceType.MANY_TO_MANY && this.property.owner) {
items.sort((a, b) => {
return order.indexOf(a._id) - order.indexOf(b._id);
});
}
this.items.push(...items);

@@ -43,0 +51,0 @@ this.initialized = true;

@@ -30,2 +30,3 @@ import { ObjectID } from 'bson';

const cond = {} as any;
const order = [] as ObjectID[];

@@ -36,3 +37,4 @@ if (this.property.reference === ReferenceType.ONE_TO_MANY) {

if (this.property.owner) {
cond._id = { $in: this.items.map(item => item._id) };
const order = this.items.map(item => item._id);
cond._id = { $in: order };
} else {

@@ -46,2 +48,10 @@ cond[this.property.mappedBy] = this.owner._id;

const items = await em.find<T>(this.property.type, cond);
// re-order items when searching with `$in` operator
if (this.property.reference === ReferenceType.MANY_TO_MANY && this.property.owner) {
items.sort((a: BaseEntity, b: BaseEntity) => {
return order.indexOf(a._id) - order.indexOf(b._id);
});
}
this.items.push(...items);

@@ -48,0 +58,0 @@ this.initialized = true;

2

package.json
{
"name": "mikro-orm",
"version": "0.7.2",
"version": "0.7.3",
"description": "Simple typescript mongo ORM for node.js based on data-mapper, unit-of-work and identity-map patterns",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc