Cannot read property 'createValueMap' of undefined
See original GitHub issueIssue type:
[ ] question [X] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[X] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] websql
TypeORM version:
[X] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
Steps to reproduce or a small repository showing the problem:
@Entity()
export class User {
@PrimaryGeneratedColumn()
id: ObjectID;
@Column()
name: string;
}
If using PrimaryGeneratedColumn instead of ObjectIdColumn, I get an error :
Error: TypeError: Cannot read property 'createValueMap' of undefined
at MongoQueryRunner.<anonymous> (C:\Users\atro\Work\typeorm-typescript-mongo-example\node_modules\typeorm\driver\mongodb\MongoQueryRunner.js:573:98)
at step (C:\Users\atro\Work\typeorm-typescript-mongo-example\node_modules\typeorm\driver\mongodb\MongoQueryRunner.js:32:23)
at Object.next (C:\Users\atro\Work\typeorm-typescript-mongo-example\node_modules\typeorm\driver\mongodb\MongoQueryRunner.js:13:53)
at fulfilled (C:\Users\atro\Work\typeorm-typescript-mongo-example\node_modules\typeorm\driver\mongodb\MongoQueryRunner.js:4:58)
at process._tickCallback (internal/process/next_tick.js:109:7)
The data is stored normally in the database. I just use the generated example:
// insert new users for test
await connection.manager.save(connection.manager.create(User, {
name: "Timber",
email: "Saw",
password: "test"
}));
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:5 (1 by maintainers)
Top Results From Across the Web
NestJS TypeORM for MongoDB Crashing After Insert
repo.save(newEntity); , the data is saved to MongoDB. But, I also get the error cannot read property “createValueMap()” of undefined ...
Read more >Cannot read property 'createValueMap' of undefined
TypeError : Cannot read property 'createValueMap' of undefined: 3c83fe6e-17d8-489d-8300-45aba1053f2b at MongoDriver.
Read more >Cannot read property 'createValueMap' of undefined
Cannot read property 'createValueMap' of undefined. weixin_45440200 于 2021-02-02 23:14:54 发布 378 收藏. 文章标签: typescript nestjs node mongodb.
Read more >typeorm/typeorm - Gitter
TypeError : Cannot read property 'name' of undefined. at Function.ColumnTypes.typeToString (eval at <anonymous> (server.js:1242:2), <anonymous>:70:20).
Read more >Cannot read property 'createValueMap' of undefined
Cannot read property 'createValueMap' of undefined. typescript nestjs node mongodb. 记录一下,一个大坑,用 ...
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
using @ObjectIdColumn instead of PrimaryGeneratedColumn works for me.
`ts import { Entity, PrimaryGeneratedColumn, Column, ObjectID, ObjectIdColumn } from “typeorm”
@Entity() export class User {
}`
Thanks for taking the time to look into this! You missed the point where I changed the id to match the RDBMS database type ( or this is my thought at least ). If you change the User id which resides in src\entity\User.ts to use PrimaryGeneratedColumn decorator instead, we get this problem