1
我的收藏:如何計算基於獨特的嵌入式陣列值
{ "_id" : 1, "type" : "A", "types" : [ "type1://asfasd", "type2://xcvxcv" ] }
{ "_id" : 2, "type" : "B", "types" : [ "type1://xcv" ] }
{ "_id" : 3, "type" : "C", "types" : [ "type2://aewqqwe" ] }
{ "_id" : 4, "type" : "D", "types" : [ "type2://xcxc" ] }
我想最終的結果來算,告訴我:
type1 -> 2 (because there are total of 2 documents that has type1)
type2 -> 3 (because there are total of 3 documents that has type2)
請問您所有的文件'types'值前綴( 'type1','type2')的長度是恆定的(這裏是5)?或者有不同長度的前綴(如'http'和'https')? – tarashypka
不是沒有固定的大小(可以是type1://,othertype3://)。我想在://之前至少有3個字母是可以的(如果substr是在這裏計劃的)? – shayy