title: Inserting array into postgresql
body: <p>I want to insert an array of id's to a file, but while creating a table I used <code>int</code>, and it has the reference of another table now how can I store array value to the specific field?
  I understand that the columns have to be the same type and I also saw that some tried to tackle this foreign key on array issue already: 
  also i tried ELEMENT according to this doc but no success. please someone help me here <a href="https://blog.2ndquadrant.com/postgresql-9-3-development-array-element-foreign-keys/" rel="nofollow noreferrer">https://blog.2ndquadrant.com/postgresql-9-3-development-array-element-foreign-keys/</a></p>
  
  <pre><code>db.query('CREATE TABLE IF NOT EXISTS departments_users(_id SERIAL NOT NULL UNIQUE PRIMARY KEY,user_id int REFERENCES companyUser ON DELETE CASCADE,department_id int REFERENCES departments ON DELETE CASCADE)');
  
  exports.addCompanyUser = function(data, callback) {
      db.query('INSERT INTO departments_users(user_id,department_id) VALUES($1,$2) RETURNING *', [companyuseraccess.rows[0]._id, data.department]).then(function(departments_users) {      
      })
  }
  </code></pre>