If you are using Sequlizejs for working with Postgres or MySQL with foreign key columns not set in the model definition like shown below: and you try to use create or bulkCreate on the model by providing the values of all fields including foreign key column like: Then it must be failing to insert proper …
Continue reading “Why Sequelizejs is inserting null for foreign key field?”
One of the reasons for this issue can be the order of statements. E.g, if you have mocked a module at line #5, but there are some other require statements at line #1,2,3,4, then it may be the case that the same module is used in those required modules (at line #1,2,3,4).
Many times there are cases when we have to use delay some functionality in javascript and the function we use for this is setTimeout(). in regular functions it works vey well and does its job, however, it becomes tricky to delay an async function using setTimeout like this: This will not work as you will …
Continue reading “How to use setTimeout with async/await in Javascript”