BasicDBList到Arraylist

时间:2018-10-05 14:28:19

标签: java mongodb mongodb-query aggregation-framework

"errors" : [ 
                {
                    "level" : "ERROR",
                    "message" : "TEST ERROR 1",
                    "timestamp" : NumberLong(1538543678998)
                }, 
                {
                    "level" : "ERROR",
                    "message" : "TEST ERROR 2",
                    "timestamp" : NumberLong(1538543678998)
                }, 
                {
                    "level" : "ERROR",
                    "message" : "TEST ERROR 3",
                    "timestamp" : NumberLong(1538543678998)
                }
            ],

这是Mongo DB中的错误的样子。我在BasicDBList中遇到“错误”。我只希望“消息”位于我的BasicDBList中,而忽略“级别”和“时间戳”

for (DBObject result : agg1.results())
{BasicDBList errors = (BasicDBList) result.get("errors"); //How to get only "message" from the BasicDBList
} 

TIA

0 个答案:

没有答案