1
この削除クエリが何日も動作しない理由を理解しようとしていますが、私は問題を見ることができません。
私は、deleteOne、findOneAndDelete、deleteManyのような多くの異なる削除クエリを試しましたが、どれもうまくいきませんでした。
私はNode.jsのNode.js "mongodb"のクエリを削除します
mongo.connect(serverAddress, (err, db) => {
//(db connection is ok, server can find and create documents)
var doc = db.collection('myCollection'),
docToDelete = "575807172154b7a019ebf6db";
//I can see the same document id on my database
doc.deleteOne({"_id":docToDelete}, (err, results) => {
console.log(`Request success : ${results.result.ok}, documents deleted : ${results.result.n}`);
//Request success : 1, documents deleted : 0, the document is still on my database
});
}
//the doc var is the same I use to add/find documents (and it works).
のために「MongoDBの」クライアントを使用して、私はMongoClientのようなソフトで同じクエリを使用する場合、それは動作します。
私はこのサイトに投稿された多くのソリューションを試してみましたが、エラーがあまりにも明白だが、私は完全に失われています。
ご協力いただきありがとうございます。
iは、完全に間違っていたあなた –
多くの感謝のために私の答え、1を削除!私はこのObjectIdメソッドをmongoのドキュメントのどこかに見たことを覚えていますが、私は接続しませんでした... – Razshal