Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
pymongo を使用して mongoDB に一括保存する関数を作成しようとしていますが、それを行う方法はありますか? 既に挿入を使用してみましたが、新しいレコードでは機能しますが、重複では失敗します。save を使用して得られるのと同じ機能が必要ですが、ドキュメントのコレクションが必要です (失敗するのではなく、既に追加されたドキュメントを同じ _id に置き換えます)。
前もって感謝します!
オプション w=0 (ex safe=False) で一括挿入を使用できますが、これが重要な場合は、すべてのドキュメントが実際に挿入されたかどうかを確認する必要があります。