Reputation: 3065
I have the following document
Previously I didn't have the embedded document vdata
and I had a field named timestamp and when I ran the query below I got the latest entry.
db.TagValues.aggregate({$match: {tagDetail: "UMIS.99TOTMW.F_CV"}}, {$sort: {timestamp: -1}}, {$limit: 1})
How do I amend the above query to show the same result based on the format of my new document. I have tried the following but I get a syntax error.
db.TagValues.aggregate({$match: {t: "UMIS.99TOTMW.F_CV"}}, {$sort: {vdata.d: -1}}, {$limit: 1})
Upvotes: 1
Views: 136