MongoDB中distinct的用法

作用

获取集合中指定字段的不重复值,并以数组的形式返回

语法

db.collection_name.distinct(field,query,options)

field:指定返回的字段(string)
query:条件查询(document)
option:其他的选项(document),查看options

举例:

猜你喜欢

转载自www.cnblogs.com/whiteBear/p/12744890.html