Hi Guys,
I am trying to get some help in querying mongo to return a sorted set based on value in the subdocument. Specifically for the below document structure I am looking to get sorted results based on systemtags: [ {key:"displayOrder", value:<long number>]. The sorting should be based on long number value for the displayOrder key. sort order does not matter though. It can be ascending or descending. Appreciate you guys' help on this.
This is how my document looks like -
{ "_id" : NumberLong("2147483692030"),
"assetType" : "DOCUMENT",
"createDate" : ISODate("2014-07-07T10:02:38.335Z"),
"dataCenter" : "AU1",
"dateTaken" : NumberLong("107136966500011"),
"files" : [
{
"fileType" : "HI1",
"url" : "string1",
"width" : NumberLong(1600),
"height" : NumberLong(1200),
"size" : NumberLong(0)
},
{
"fileType" : "HI2",
"url" : "string2",
"width" : NumberLong(0),
"height" : NumberLong(0),
"size" : NumberLong(0)
},
{
"fileType" : "HI3",
"url" : "String3",
"width" : NumberLong(800),
"height" : NumberLong(600),
"size" : NumberLong(0)
}
],
"hashAccountId" : NumberLong("9916768824"),
"markedForDelete" : false,
"ownerAccountId" : NumberLong("1003816101211"),
"parentCollectionReferences" : [
{
"ownerAccountId" : NumberLong("1003816101211"),
"collectionId" : NumberLong("214748366302011")
}
],
"systemTags" : [
{
"value" : "JQK",
"key" : "uploadTypeCode"
},
{
"value" : NumberLong("1404727360843"),
"key" : "displayOrder"
},
{
"value" : "/ar=1/pe",
"key" : "journalDeveloper"
}
]
}