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.
私はこのスキーマ articleSchema を持っています:
{ //other attributes tags : [ String ] }
特定の基準に基づいて記事を検索し、タグのみを取得してから、すべての記事からタグの単一の配列を作成し、重複しないようにしたいと考えています。
これを行うための mondgodb と mongoose の組み込み機能はありますか?
WiredPrairie が指摘したようdistinctに、解決策でした。
distinct
var query = { /** Query for the articles that I want tags from */ }; //Using mongoose-q return Article.distinctQ('tags', query);