Unclear documentation: create() doesn't actually insert new row
Problem
Issue type: [ ] question [ ] bug report [ ] feature request [x] documentation issue Database system/driver: [ ] `cordova` [ ] `mongodb` [ ] `mssql` [ ] `mysql` / `mariadb` [ ] `oracle` [ ] `postgres` [x] `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: Currently, `repository.create()` creates new instance of entity, but doesn't put it into db - you have to manually call `repository.save()` afterwards so that typeorm would actually run INSERT statement. I think that a lot of developers may not understand it from current documentation, and that it should be said so explicitly to avoid confusion. (Will submit PR to docs myself if maintainers approve this).
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Unclear documentation: create() doesn't actually insert new row
@pleerock that's exactly the place I was talking about. You're absolutely right that it doesn't say that it inserts an element into a database, and I did feel like an idiot after I realized my mistake. However, I don't think that I'm the only one, and adding a short disclaimer would prevent a lot of other developers from making a similar mistake as me.
Trust Score
9 verifications
- 1
@pleerock that's exactly the place I was talking about. You're absolutely right
@pleerock that's exactly the place I was talking about. You're absolutely right that it doesn't say that it inserts an element into a database, and I did feel like an idiot after I realized my mistake.
- 2
However, I don't think that I'm the only one, and adding a short disclaimer woul
However, I don't think that I'm the only one, and adding a short disclaimer would prevent a lot of other developers from making a similar mistake as me.
Validation
Resolved in typeorm/typeorm GitHub issue #1789. Community reactions: 111 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep