Expanding Serials - jkossi/Bss_Support GitHub Wiki
Expanding Serials When Giving a Range
use drm_prod_bss;
db.getCollection('physicalresources').aggregate(
[
{"$unwind": "$category"},
//{"$match":{'value': {"$in":['8923301001010864626']}}},
//{"$match":{'value': {"$gte":'8923301001012478771', "$lte":'8923301001012479761'}}},
{"$match":{"$or":[
{'value': {"$gte":'8923301001022309875', "$lte":'8923301001022310865'}},
//{'value': {"$gte":'8923301001012487772', "$lte":'8923301001012488762'}}
]}},
{
"$lookup": {
"from": "resourcecategories",
"localField": "category",
"foreignField": "_id",
"as": "category_details"
}
},
{"$project": {
"_id":0,
"value": 1,
"operationalState": 1,
"resourceStatus": 1,
SIM_NUM:{'$arrayElemAt': ["$resourceCharacteristic.value", 0]},
PIN1:{'$arrayElemAt': ["$resourceCharacteristic.value", 1]},
PIN2:{'$arrayElemAt': ["$resourceCharacteristic.value", 2]},
PUK1:{'$arrayElemAt': ["$resourceCharacteristic.value", 3]},
PUK2:{'$arrayElemAt': ["$resourceCharacteristic.value", 4]},
KI:{'$arrayElemAt': ["$resourceCharacteristic.value", 6]},
IMSI:{'$arrayElemAt': ["$resourceCharacteristic.value", 7]},
SIMTYPE:{'$arrayElemAt': ["$resourceCharacteristic.value", 11]},
SIM_CATEGORY:{'$arrayElemAt': ["$category_details.name", 0]}
}
}
])
``