在我的 angular2 项目中,我需要使用相同的数据更新多个 id。我有一个这样的函数:
import { AgentApi } from '../../../../sdk/services/custom/Agent';
@Injectable()
export class AgentService {
constructor(private agentApi: AgentApi) { }
updateAgentShiftDetails(idArray, name) {
var dataObj: any = {};
dataObj.id = {
'inq': idArray ------> id array contains ids like this:["590b095a0d271a0cb8e859sf", "590c63cee3adb75a19e84e56"]
};
return this.agentApi.updateAll({
where: {
'id': dataObj
}
}, {
'name': name
});
};
}
在我的响应正文中,我收到了这样的错误:
Object {statusCode: 500, name: "MongoError", message: "unknown operator: $id", ok: 0, errmsg: "unknown operator: $id"…}
500 (Internal Server Error)
我该如何解决这个问题?我正在使用环回和 mongodb。我是 angular2 的新手。任何帮助都会非常显着。