2
我使用graphql繼電器,我的項目GraphQL繼電器返回一條記錄
當我grapgql運行此查詢:
{
viewer{
boRelayCustomerInfo(_id:"59267769de82262d7e39c47c") {
edges {
node {
id
}
}
}
}
}
我給了這個錯誤: "message": "arraySlice.slice is not a function"
我的查詢代碼:
import {
GraphQLID,
GraphQLNonNull,
} from 'graphql'
import {
connectionArgs,
connectionFromPromisedArray,
} from 'graphql-relay'
import { customerConnection } from '@/src/schema/type/customer/CustomerType'
import { CustomerModel, ObjectId } from '@/src/db'
export default {
type: customerConnection.connectionType,
args: {
...connectionArgs,
_id: {
type: new GraphQLNonNull(GraphQLID),
},
},
resolve: (_, args) => connectionFromPromisedArray(
CustomerModel.findOne({_id: ObjectId(args._id)}),
args,
),
}
請告訴我們,如何只返回一個re在繼電器的繩子。