[Question] How to return the `mpath` field with TreeRepository?
See original GitHub issueIssue type:
[x] question [ ] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[] mssql
[x] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)
Steps to reproduce or a small repository showing the problem:
here is my entity
import {
Entity,
Column,
PrimaryGeneratedColumn,
CreateDateColumn,
UpdateDateColumn,
Tree,
TreeChildren,
TreeParent,
} from 'typeorm';
@Entity()
@Tree('materialized-path')
export class Permission {
permission: Promise<Permission>;
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({
length: 20,
})
name: string;
@Column({
length: 100,
})
identify: string;
@Column({
length: 20,
nullable: true,
})
alias: string;
@Column({
type: 'int',
default: 0,
})
type: number;
@Column({
type: 'int',
default: 1,
})
isShow: number;
@Column({
type: 'int',
default: false,
})
hasChildren: boolean;
@Column({
length: 100,
nullable: true,
})
icon: string;
@Column({
type: 'int',
default: 0,
})
sortId: number;
@Column({
length: 100,
nullable: true,
})
url: string;
@TreeChildren()
children: Permission[];
@TreeParent()
parent: Permission;
@CreateDateColumn()
createdAt;
@UpdateDateColumn()
updatedAt;
}
I used the @Tree('materialized-path'), it generated the mpath parentId field in my tables
this.permissionRepository.find({
where: { parent: pid },
});
How can I return the mpath field ?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:8
Top Results From Across the Web
How to change "mpath" field name of materialized-path tree in ...
Is there any way to change the name of the "mpath" column that is automatically generated when using the materialized-path tree structure on ......
Read more >Class TreeRepository<Entity> - typeorm
Returns object that is managed by this repository. If this repository manages entity from schema, then it returns a name of that schema...
Read more >[PATCH v4 00/25] InfiniBand Transport (IBTRS) and Network Block ...
IBTRS is multipath capable and provides I/O fail-over and load-balancing functionality, ... + + if (q) + ibnbd_clt_dev_requeue(q); + + return !!q; ...
Read more >disjoint decision trees: Topics by Science.gov
The Decision Tree involves a sequence of questions/decisions that can be answered in ... Decision trees are widely used in the field of...
Read more >3-540-45812-3.pdf - Springer Link
underlying QoS routing algorithm (i.e., Q-OSPF with the enhanced routing algo- ... during exchange; (3) helps SP in using the information generated by...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
My workaround is to specify mpath field as
mpath?: string, without column decorator. And then for entity instance set TypeORM mpath field not virtual:entityName.metadata.columns.find(x => x.databaseName === 'mpath').isVirtual = false@arminghm I am using this: