Skip to content

Commit

Permalink
typeorm uses collection name for EntitySchema
Browse files Browse the repository at this point in the history
  • Loading branch information
marcj committed Sep 9, 2019
1 parent 0528c9d commit 422cf3f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/mongo/src/typeorm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
getCollectionName,
getDatabaseName,
getEntityName,
getEntitySchema,
Expand Down Expand Up @@ -65,7 +66,7 @@ function propertyToColumnOptions<T>(classType: ClassType<T>, propertyName: strin
}

export function getTypeOrmEntity<T>(classType: ClassType<T>): EntitySchema<T> {
const name = getEntityName(classType);
let name = getCollectionName(classType) || getEntityName(classType);
const schema = getEntitySchema(classType);

const indices: EntitySchemaIndexOptions[] = [];
Expand Down
1 change: 0 additions & 1 deletion packages/mongo/tests/typeorm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ test('test actual sync', async () => {

// await connection.connect();
const indexes = await connection.mongoManager.queryRunner.collectionIndexes('simple_model');
console.log('indexes', indexes);
expect(indexes.length).toBe(3);
expect(indexes[0].key).toEqual({_id: 1});

Expand Down

0 comments on commit 422cf3f

Please sign in to comment.