1
我遇到了麻烦,在客户端获取查询的响应。服务器端很好,显然。
这是服务器端查询的样子:
gfs.files.find({
"metadata.owner": req.params.driver
}).toArray(function(err, files) {
if (err) {
return handleError(err);
}
console.log(files); /* files contents the correct result */
return files;
});
这里是我的客户端,在那里我没有得到一个结果:
GridFS.query({
driver: user._id
}, function(err, res) {
if (err) {
console.log(err);
}
console.log(res); /* nothing here*/
});
其实,我不知道得到任何错误,直到我刷新页面,当我得到这个:
Possibly unhandled rejection: {"data":null,"status":-1,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"/api/gridfs/5978d197b24dfa0f87160617","headers":{"Accept":"application/json, text/plain, */*","Authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1OTc4ZDE5N2IyNGRmYTBmODcxNjA2MTciLCJyb2xlIjoiZHJpdmVyIiwiaWF0IjoxNTAxNDEyMzI1LCJleHAiOjE1MDE0MzAzMjV9.EWCQ6jm_uXe1KQIhMaqnIff8UUeMZfUV8CZfeDI95qk"}},"statusText":""} vendor.bundle.js:14487:19