Mongoose 图ql";ID不能表示值…”;错误,但变异工作正常

Mongoose 图ql";ID不能表示值…”;错误,但变异工作正常,mongoose,graphql,Mongoose,Graphql,我看不出这个问题 我正在使用mongoose,解析器在DB中工作正常,但我在GraphQL中收到此错误: "errors": [ { "message": "ID cannot represent value: <Buffer 5d d4 35 8d b1 d1 60 1e 38 34 7b fc>", "locations": [ { "line": 8, "column": 7

我看不出这个问题

我正在使用mongoose,解析器在DB中工作正常,但我在GraphQL中收到此错误:

"errors": [
    {
      "message": "ID cannot represent value: <Buffer 5d d4 35 8d b1 d1 60 1e 38 34 7b fc>",
      "locations": [
        {
          "line": 8,
          "column": 7
        }
      ],
      "path": [
        "deleteCollection",
        "products",
        0,
        "id"
      ]....
我相信问题就在这里:

//find products in collection
    const products = await context.Product.find({
      collections: { $in: [collection._id] }
    });

//for every product in collection, remove it
    await products.map(
      async (product) => (
        product.collections.pull(collection._id), await product.save()
      )
    );
因为如果集合中没有产品,当我删除它时,就不会有错误。 我还将此解析器用于graphql
类型产品

const Product = {
  id: (parent, args, context, info) => {
    return parent.id || parent._id;
  }
};
请帮忙

const Product = {
  id: (parent, args, context, info) => {
    return parent.id || parent._id;
  }
};