I have a list of integers and list names and I inserted this information in mongodb via console using following code
db.collection.insert({"_id":"integers","data":[1,2,3,4,5]})
db.collection.insert({"_id":"names","data":["A","B","C","D"]})
the query db.collection.find().pretty gave the following result
{ "_id" : "ArrayList", "data" : [ 1, 2, 3, 4, 5, 6 ] }
{
"_id" : "Names",
"data" : [
"A",
"B",
"C",
"D"
]
}
How to do it in java?