Skip to content

docs: add note for find*create functions#11069

Merged
sushantdhiman merged 2 commits intosequelize:masterfrom
levibostian:findcreate-doc
Jun 26, 2019
Merged

docs: add note for find*create functions#11069
sushantdhiman merged 2 commits intosequelize:masterfrom
levibostian:findcreate-doc

Conversation

@levibostian
Copy link
Copy Markdown
Contributor

I spent a few days this week pounding my head against the wall wondering why when I would run any of the Model.find*Create() functions, whatever I was putting into the where options parameter, it was getting inserted into the database.

From reading the docs and also assuming that where is only used for the "WHERE" query generation, I finally dug into the source code of sequelize and realized my issue.

I thought it would be helpful for others to realize when they use any of these functions that the where option will be used in the create query.

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 25, 2019

Codecov Report

Merging #11069 into master will decrease coverage by 6.79%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #11069     +/-   ##
=========================================
- Coverage   96.34%   89.55%   -6.8%     
=========================================
  Files          94       92      -2     
  Lines        9009     8913     -96     
=========================================
- Hits         8680     7982    -698     
- Misses        329      931    +602
Impacted Files Coverage Δ
lib/model.js 96.62% <ø> (-0.07%) ⬇️
lib/dialects/mssql/query-generator.js 2.63% <0%> (-93.28%) ⬇️
lib/dialects/mssql/query-interface.js 8.69% <0%> (-91.31%) ⬇️
lib/dialects/mssql/query.js 5.68% <0%> (-89.78%) ⬇️
lib/dialects/mssql/resource-lock.js 22.22% <0%> (-77.78%) ⬇️
lib/dialects/mssql/data-types.js 30.12% <0%> (-69.88%) ⬇️
...dialects/abstract/query-generator/helpers/quote.js 93.33% <0%> (-6.67%) ⬇️
lib/dialects/abstract/query-generator.js 93.75% <0%> (-3.84%) ⬇️
lib/sequelize.js 95.28% <0%> (-0.63%) ⬇️
lib/query-interface.js 91.72% <0%> (-0.49%) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dcf079b...5e8dcaa. Read the comment docs.

@sushantdhiman
Copy link
Copy Markdown
Contributor

I mentioned create for last two methods, but "build" is sufficient

@sushantdhiman sushantdhiman merged commit fa57155 into sequelize:master Jun 26, 2019
@sushantdhiman
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

schmod pushed a commit to schmod/sequelize that referenced this pull request Jul 10, 2019
…ndle-deadlock

* 'master' of github.com:sequelize/sequelize: (22 commits)
  docs(migrations): use timestamps with seed (sequelize#11160)
  test: remove redundant test (sequelize#11156)
  fix(types): add literal to possible where options (sequelize#10990)
  fix(model): don't alter original scopes when combining them (sequelize#10722)
  fix(types): relax order typing (sequelize#10802)
  fix(types): add string to Includeable (sequelize#11003)
  docs(models-definition): correct spelling mistakes (sequelize#11147)
  fix(types): silent option for update (sequelize#11115)
  fix: update sequelize-pool (sequelize#11134)
  feat(hooks): beforeDisconnect / afterDisconnect (sequelize#11117)
  refactor: remove unused _templateSettings
  refactor(query-generation): remove lodash string templates (sequelize#11122)
  docs: improve datatype docs
  docs: explain defaults/where behavior for find/create (sequelize#11069)
  build: remove test*.js from .gitignore (sequelize#11108)
  docs(data-types): extending types
  fix(sequelize.close): update sequelize-pool (sequelize#11101)
  build: update dependencies (sequelize#11099)
  docs(migrations): foreign key example (sequelize#11097)
  fix(mariadb): properly escape json path key (sequelize#11089)
  ...
@sushantdhiman
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 7.0.0-next.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants