Open bunop opened 1 year ago
this query can create a new collection with only the supported coordinates:
db.variantSheep.aggregate([
{ $unwind: "$locations" },
{
$match: {
$or: [
{ "locations.version": "Oar_v4.0", "locations.imported_from": "SNPchiMp v.3" },
{ "locations.version": "Oar_v3.1", "locations.imported_from": "SNPchiMp v.3" }
]
}
},
{
$group: {
_id: "$_id",
chip_name: { $first: "$chip_name" },
name: { $first: "$name" },
sequence: { $first: "$sequence" },
illumina_top: { $first: "$illumina_top" },
sender: { $first: "$sender" },
rs_id: { $first: "$rs_id" },
locations: { $push: "$locations" },
all_fields: { $mergeObjects: "$$ROOT" }
}
},
{
$replaceRoot: {
newRoot: {
$mergeObjects: [
{ $arrayToObject: { $objectToArray: "$all_fields" } },
{ locations: "$locations" }
]
}
}
},
{ $limit: 2 }
], { allowDiskUse: true }).pretty()
Need to check if the fields non in the $group
statement are preserved
display only smarter coordinates in variant detail endpoint. This could be done by creating a new collection with only the information I need. This collection will be served by the endpoint.