Ich versuche eine Website zu erstellen, wo ich Fragen stellen und beantworten kann. Um dies zu tun, habe ich zwei Dateien, eine, die die Frage an die Datenbank sendet, und die andere, die die Anlage von jedem docs
, in dem die Frage ist, ausgibt.Erhalten Sie PouchDB Anhang?
Post.js:
db.post({
title: 'question'
}).then(function (response) {
console.log(response)
q = response
}).catch(function (err) {
console.log(err);
});
await sleep(100)
console.log(q.rev)
var attachment = new Blob([{
"title" : title,
"content" : content,
"option" : option,
"spec" : spécialisation,
"year" : year,
"date" : date}, {type: 'text/json'}]);
db.putAttachment(q.id.toString(),'qData', q.rev.toString(), attachment, 'text/json')
.then(function (result) {
console.log(result)
})
.catch(function (err) {
console.log(err);
});
Und view.js:
var all = db.allDocs({
}).then(function (result) {
console.log(JSON.stringify(result.rows))
return result.rows
}).catch(function (err) {
console.log(err);
});
Aber ich kann es nicht zu arbeiten, gibt es keine Fehler und die einzelnen ouput, die ich erhalte a Doc ohne Anhang. Was ist mein (wahrscheinlich neuerlicher) Fehler?