[英]BasicDBList to Collection MongoDB
This may seem like a dumb question but I don't know how to do this. 这似乎是一个愚蠢的问题,但我不知道该怎么做。
I have a document in a DBCollection
that looks like this: 我在
DBCollection
中有一个文档,如下所示:
{
"_id" : ObjectId("4ef4ee517e696a48037861c8"),
"income" : 2500,
"month" : "2011-12",
"expenses" : [
{
"id" : 1,
"category" : "EMERGENCY",
"type" : "SAVING",
"date" : "2011-12-23 10:25:30",
"value" : 0.25"
} ]
}
I want to get all the elements of the inner array and put them into a Collection
(Java Collection
, eg List<E>
), but I can't seem to find anything on how to do it (and I've searched). 我想获取内部数组的所有元素并将它们放入
Collection
(Java Collection
,例如List<E>
),但我似乎找不到任何关于如何做到的事情(我已经搜索过)。
It is already a java.util.List (BasicDBList implements java.util.List) 它已经是java.util.List(BasicDBList实现了java.util.List)
http://api.mongodb.org/java/current/com/mongodb/BasicDBList.html http://api.mongodb.org/java/current/com/mongodb/BasicDBList.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.