問題タブ [mongoose-plugins]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
node.js - nodejs の不正なリクエスト
ユーザーサインアップの作成には、passportjs と Passport-local-mongoose を使用しました。これは私のコードです
サインアップの送信ボタンをクリックすると、bad requestというエラーが表示されます。これはコンソールに表示されるメッセージです{ [UserExistsError: A user with the given username is already registered] name: 'UserExistsError', message: 'A user with the given username is already registered' }
node.js - mongoose-observer ライブラリの使用中に MissingSchemaError が発生する
典型的な Node.js、express、mongoDB、および mongoose アプリケーションがあります。
mongodb の変更をリッスンするために mongoose-observer ライブラリを実装しようとしています。サイトを参照してください: https://www.npmjs.com/package/mongoose-observer
このコードを追加する場合 (提供された例とほぼ同じ):
次のエラーが表示されます。
このエラーは、mongoose-observer コードを追加した場合にのみ発生し、それがなくても問題なく動作します。
関連する可能性のあるその他のコード
このライブラリが多くの人に使用されていないことはわかっていますが、明らかな何かが欠けている可能性があります。
このエラーを含む他の投稿を見たことがありますが、これは特定のライブラリ コードを実装するときにのみ発生するため、別の問題があるようです。
どんな助けでも大歓迎です。
編集: @Love-Kesh の答えは正しかったが。このライブラリは Node.js 内からの変更をリッスンするためのものであり、外部から追加されたデータは検出されないことがわかりました。