MongoCollectionDistinct[MongoCollection[…],f]
コレクション内の field の別個の値のリストを取得する.
MongoCollectionDistinct[MongoCollection[…],field,query]
query に合致するドキュメントの field の別個の値のリストを取得する.
MongoCollectionDistinct
MongoCollectionDistinct[MongoCollection[…],f]
コレクション内の field の別個の値のリストを取得する.
MongoCollectionDistinct[MongoCollection[…],field,query]
query に合致するドキュメントの field の別個の値のリストを取得する.
詳細とオプション
- MongoCollectionDistinctを使用するためには,まずNeeds["MongoLink`"]を使ってMongoLinkをロードする必要がある.
- MongoCollectionDistinctはListを返す.
- MongoCollectionDistinctはdb.collection.distinctに相当する.
例題
例 (1)
Needs["MongoLink`"]client = MongoConnect[]"WolframTestDB"データベース内の新しい"WolframTestDistinct"コレクションに接続する:
coll = client["WolframTestDB"]["WolframTestDistinct"]data = Dataset[{<|"_id" -> 1, "dept" -> "A", "item" -> <|"sku" -> "111", "color" -> "red"|>, "sizes" -> {"S", "M"}|>,
<|"_id" -> 2, "dept" -> "A", "item" -> <|"sku" -> "111", "color" -> "blue"|>, "sizes" -> {"M", "L"}|>,
<|"_id" -> 3, "dept" -> "B", "item" -> <|"sku" -> "222", "color" -> "blue"|>, "sizes" -> "S"|>,
<|"_id" -> 4, "dept" -> "A", "item" -> <|"sku" -> "333", "color" -> "black"|>, "sizes" -> {"S"}|>}]MongoCollectionInsert[coll, Normal[data]]MongoCollectionDistinct[coll, "dept"]"item"フィールドの"sku"サブフィールドの別個の項目のリストを求める:
MongoCollectionDistinct[coll, "item.sku"]"dept"フィールドの値が"A"であるドキュメントの"item"フィールドの"sku"サブフィールドの別個の項目のリストを求める:
MongoCollectionDistinct[coll, "item.sku", <|"dept" -> "A"|>]MongoCollectionDrop[coll]テクニカルノート
関連するガイド
テキスト
Wolfram Research (2018), MongoCollectionDistinct, Wolfram言語関数, https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionDistinct.html.
CMS
Wolfram Language. 2018. "MongoCollectionDistinct." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionDistinct.html.
APA
Wolfram Language. (2018). MongoCollectionDistinct. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionDistinct.html
BibTeX
@misc{reference.wolfram_2026_mongocollectiondistinct, author="Wolfram Research", title="{MongoCollectionDistinct}", year="2018", howpublished="\url{https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionDistinct.html}", note=[Accessed: 12-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_mongocollectiondistinct, organization={Wolfram Research}, title={MongoCollectionDistinct}, year={2018}, url={https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionDistinct.html}, note=[Accessed: 12-August-2026]}