問題タブ [mongoose-populate]
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 - マングースのサブポピュレートが機能しない
ここに私のスキーマがあります:
このコードは機能し、source_pages に正常に入力されます。
しかし、製品にも入力したい場合:
このエラー:
TypeError: 検索 (/home/sina/rhino2/node_modules/mongoose/lib/) で検索 (/home/sina/rhino2/node_modules/mongoose/lib/model.js:2088:28) で undefined のメソッド 'path' を呼び出せませんmodel.js:2107:22) Function._getSchema (/home/sina/rhino2/node_modules/mongoose/lib/model.js:2114:5) で populate (/home/sina/rhino2/node_modules/mongoose/lib/) でmodel.js:1719:22) 関数.Model.populate (/home/sina/rhino2/node_modules/mongoose/lib/model.js:1702:5) で cb (/home/sina/rhino2/node_modules/mongoose/) lib/query.js:1690:11) で /home/sina/rhino2/node_modules/mongoose/lib/utils.js:414:16 で /home/sina/rhino2/node_modules/mongoose/node_modules/mongodb/lib/mongodb /cursor.js:158:16 で commandHandler (/home/sina/rhino2/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:643:16) で null。(/home/sina/rhino2/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1641:20)
mongodb - 次の Mongoose クエリを作成するにはどうすればよいですか?
ここに私のスキーマがあります:
基本的に、A
には への参照を持つコンテナの配列があり、 にB
は およびB
への参照がC
ありD
ます。
今、私は a の ID を持っており、 sによって使用されるC
セットが必要です。これは可能ですか?何らかの方法でスキーマを変更する必要がありますか?D
active
A
編集:ここに実際のスキーマ
node.js - populate() が使用されている場合に mongoose 仮想属性が設定されない
オブジェクト ( )job.creator
の仮想属性を入力して使用し、ジョブの作成者に公開情報のみを提供しようとしています。User
user.profile
.profile
オブジェクトから仮想属性を取得しようとすると、job.creator
いくつかの値が不足しています:
job.creator.profileImageUrls
User オブジェクトの仮想属性であるそれも欠落しています。