Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Tom
@moT01
@harut-g do you have the code somewhere?
Harut
@harut-g
This message was deleted
                Facility.create(filesJson['facilities'], (err, result) => {
                   if (err) throw err;
                });

                People.create(filesJson['people'], (err, result) => {
                    if (err) throw err;
                });
@moT01 I need to send response when these two methods are done
Tom
@moT01
node?
express
Harut
@harut-g
@moT01 yes
Tom
@moT01
here's some code i've used
newBook.save().then(() => {
             books.find().then(r => {
res.send([r,message]);
i dunno, that's an area i need improvement on
so yours might look like...
facility.create(files.....).then((err,result) => {
    stuff
   people.create().then( => {
     res.send
  }

})
Tom
@moT01
probly not the best way to go, i think that stops the code - when ideally you probly want both of those to start together then send a response when the last one is done
someone posted a link to here about this - i didnt read it, but it might help http://www.datchley.name/es6-promises/
Chris Rutherford
@cjrutherford
anyone good with troubleshooting seed issues?
anyone here to answer questions?
Tom
@moT01
i cant try
Chris Rutherford
@cjrutherford

thanks @moT01 , I'm trying to see my database, and have two models that I have the seed data for in a JSON file. Both seed scripts are nearly identical. The only difference is the JSON file that gets imported, and the variable name that represents the seed data after import. The first imports fine, and the second files with an error like this:

== 20171030160224-outsider: migrating =======
Seed file failed with error: Cannot read property 'autoIncrement' of undefined TypeError: Cannot read property 'autoIncr
ement' of undefined
    at C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\sequelize\lib\dialects\mssql\query-generator.js
:264:48
    at C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:4389:15
    at baseForOwn (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:2652:24)
    at Function.forOwn (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:12254:24)
    at C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\sequelize\lib\dialects\mssql\query-generator.js
:258:15
    at arrayEach (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:473:11)
    at Function.forEach (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:8561:14)
    at Object.bulkInsertQuery (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\sequelize\lib\dialects\
mssql\query-generator.js:248:13)
    at QueryInterface.bulkInsert (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\sequelize\lib\query-
interface.js:568:33)
    at Object.up (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\server\seeders\20171030160224-outsider.js:7:27)
    at Migration._callee$ (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_modules\umzug\lib
\migration.js:178:35)
    at tryCatch (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_modules\regenerator-runtime
\runtime.js:65:40)
    at Generator.invoke [as _invoke] (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_module
s\regenerator-runtime\runtime.js:299:22)
    at Generator.prototype.(anonymous function) [as next] (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequ
elize-cli\node_modules\regenerator-runtime\runtime.js:117:21)
    at step (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_modules\babel-runtime\helpers\a
syncToGenerator.js:17:30)
    at C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_modules\babel-runtime\helpers\asyncTo
Generator.js:28:13
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

The seed script is as follows:

'use strict';
const cjson = require('cjson');
var outsiderData = cjson.load('server/seeders/Outsider.json');

module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.bulkInsert('Outsiders', outsiderData);
  },

  down: (queryInterface, Sequelize) => {
    return queryInterface.bulkDelete('Outsiders', null, {});
  }
};
Tom
@moT01
whats next
wheres the auto increment
Chris Rutherford
@cjrutherford
The auto increment is in the migration file, and is on the Id field that is provided by Sequelize when generating the Migration.
I assume the Next is something in the pipeline for Sequelize.
oh sorry this is the wrong chat.....
Thanks anyway Tom
Tom
@moT01
what
you can chat wherever you want
Chris Rutherford
@cjrutherford
lol, I was looking for the Sequelize chat. though.... lol all good
Tom
@moT01
well, i wanted to see where you were setting the autoIncrement - or where - or the code you were using to grab that info
it says undefined there, i think thats an async issue
or sync
whatever
Matt
@DaftlyPunkish
How do you send a script instead of just copy-pasting?
Chris Rutherford
@cjrutherford

Yes, the code for the Auto Increment is here:

'use strict';
module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.createTable('Outsiders', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      firstName: {
        type: Sequelize.STRING,
        allowNull: false
      },........

this is supposed to handle the auto increment of table keys on it's own, but I guess it's borked.

I'll link you my repo so you can take a look.
Tom
@moT01
@cjrutherford yea, im not sure
if the first one works
try the second again
look for typos
is the file the right structure
im sure you did all that
Chris Rutherford
@cjrutherford
yeah, it's a quagmire, I'm going to look up another tutorial and start from scratch. they're really no help over there.
Kaz Baig
@kbaig
@alpox do you do sass
alpox
@alpox
@kbaig I did do some
Long not anymore
Marius Nicolae
@bytao7mao
@bytao7mao
hi guys, i have a little issue, im trying to link in my JSON some objects
does someone here have some experience?
Harut
@harut-g
@bytao7mao can you provide some details or code example?
Marius Nicolae
@bytao7mao
Before i provide the code i want to give some info
of what i want to do
i want to link my winner or looser ID with ID of Country
Marius Nicolae
@bytao7mao
the logic is: if points of x.inv is > than x.def (see var x) then link the ID with countries ID (var y)
i get this now but it is not ok :)) because i getting only the index 1 from all
"85 > 37 Winner is: Brazil"