0
私は今、私は私のクエリには二つの問題を持って実現するブール値によって、クエリの結果を除外します。
1(私の元の質問):私はブール値でMongoのクエリからの結果をフィルタリングするためにしようとしているノード/エクスプレスで
。十分に単純なはずですか?基本的には、プロファイルが完了していない場合、私はそのユーザーを無視したい。
これがボールを再生されていないクエリの特定の部分である:
{profileComplete: {$ne: false}}
私は$nin
ため$ne
を交換しようとしたが、これはどちらかの作業をdoes't。
質問に間違っていますか?
ここでは全体のクエリは便利だ場合には、です:
req.session.query = {$and:
[
{learningLanguages: {$in: req.user.spokenLanguages}}, // matches other users' learning languages with the current users spoken language(s)
{_id: {$nin: [req.user.blockedUsers.split(","), req.user._id]}}, // disregard users who have been blocked by the current user AND the current user him/herself
{profileComplete: {$ne: false}} // disregard users who haven't completed their profiles yet.
]
}
2:
私もちょうど結果から自分のログイン中のユーザーをブロックすることはどちらか動作していないことが判明しました。これはクエリのこの行の最後のビットです:{_id: {$nin: [req.user.blockedUsers.split(","), req.user._id]}}
私はMongoDBを把握していましたが、