How to insert multiple records with OrientJS?

329 Views Asked by At

I just started with OrientJS and OrientDB and I try to insert multiple records at the same time.

If I use this code nothing happens, no error, but no insertion either, what do i do wrong?

testRecords.map(el =>
    db
      .insert()
      .into('Profile')
      .set({
        email: el.email,
        password: el.password,
        verifyEmailToken: el.verifyEmailToken,
        changePasswordToken: el.changePasswordToken,
      })
      .one());

If I use the OrientDB SQL and the db.query then it works fine with this code below (but with this it looks kinda strange how I have to setup the values, one example value from the value array looks like this example '("[email protected]", "123", "123456789", "123456789")'

const OSQL = `INSERT INTO ${className} (${properties}) VALUES ${testValues}`;
console.log(OSQL);

db.query(OSQL);

Can somebody guide me how to use properly the OrientJS API?

0

There are 0 best solutions below