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.2.0 to 0.2.1

2

lib/BaseEntity.ts

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

collection: boolean;
attributes: { [attribute: string]: any };
attributes?: { [attribute: string]: any };
}

@@ -86,0 +86,0 @@

@@ -20,3 +20,3 @@ import { BaseEntity, EntityProperty } from '../BaseEntity';

meta.properties = meta.properties || {};
meta.properties[propertyName] = { ...options } as EntityProperty;
meta.properties[propertyName] = Object.assign({}, options, { reference: false, collection: false }) as EntityProperty;
};

@@ -23,0 +23,0 @@ }

@@ -180,2 +180,7 @@ import { Collection as MongoCollection, Db, FilterQuery } from 'mongodb';

canPopulate(entityName: string, property: string): boolean {
const props = this.metadata[entityName].properties;
return property in props && props[property].reference;
}
/**

@@ -182,0 +187,0 @@ * @todo improve this for find() operations

@@ -30,2 +30,6 @@ import { FilterQuery } from 'mongodb';

canPopulate(property: string): boolean {
return this.em.canPopulate(this.entityName, property);
}
create(data: any): T {

@@ -32,0 +36,0 @@ return this.em.create<T>(this.entityName, data);

{
"name": "mikro-orm",
"version": "0.2.0",
"version": "0.2.1",
"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",

@@ -162,2 +162,10 @@ 'use strict';

});
test('catPopulate', async () => {
const repo = orm.em.getRepository<Author>(Author.name);
expect(repo.canPopulate('test')).toBe(false);
expect(repo.canPopulate('name')).toBe(false);
expect(repo.canPopulate('favouriteBook')).toBe(true);
expect(repo.canPopulate('books')).toBe(true);
});
});

@@ -164,0 +172,0 @@

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