我試圖從AngularJS形式做Couchbase一個簡單的CRUD操作,但我不斷收到此錯誤:Couchbase插入 - 類型錯誤:轉換圓形結構,以JSON
TypeError: Converting circular structure to JSON
以下是主要的片段AngularJS和Express.js。任何幫助將不勝感激。
//AngularJS
$http.post('docs', $scope.doc).then(function(res) {
console.log(res);
}, function(err) {
console.log(err);
});
//Express.js
router.post('', function(req, res, next) {
db.upsert('anyname', req.body, function(error, result) {
if (error) {
console.log('operation failed', error);
return;
}
res.send(res);
});
});
從終端詳細的出錯:
/Users/name/Workspace/sb-couchbase/node_modules/express/lib/response.js:242
var body = JSON.stringify(val, replacer, spaces);
^
TypeError: Converting circular structure to JSON
at Object.stringify (native)
at ServerResponse.json (/Users/name/Workspace/sb-couchbase/node_modules/express/lib/response.js:242:19)
at ServerResponse.send (/Users/name/Workspace/sb-couchbase/node_modules/express/lib/response.js:151:21)
at /Users/name/Workspace/sb-couchbase/routes/document.js:36:8