admin管理员组

文章数量:1292359

I have an array of plain JavaScript objects that need to be inserted into a Catalyst NoSQL Table using the Catalyst Node.js SDK. When I try to construct new NoSQL items using the NoSQLItem.from() method by passing the array, I encounter the following error.

Error Message: Value provided for values is expected to be a non-empty Array

 const { NoSQLItem } = require("zcatalyst-sdk-node/lib/no-sql");
    const catalystApp = catalyst.initialize(req);
    const nosql = catalystApp.nosql();
    const table = await nosql.getTable("orders");

    const plainJson = [
      { pkey: 1, skey: 1200 },
      { pkey: 1, skey: 1201 },
      { pkey: 1, skey: 1202 },
    ];
    const NoSQL_Item = NoSQLItem.from(plainJson);
    const plainInsert = await table.insertItems(NoSQL_Item);

本文标签: