使用Java操作MongoDB - Insert ISODate

We could insert data with json as:

1
2
3
4
5
6
7
8
9
10
11
12
{
"name_collection1": [
{
"attribute_1":"value1",
"attribute_2":"value2"
},

{
"attribute_3":2,
"attribute_4":"value4"
}

]
}

If you want to use ISODate function or any other javascript function you should see how MongoDB Java Driver deals with it. For example in case of ISODate:

1
"bornAt":{ "$date" : "2015-01-05T10:09:15.210Z"}

唐胡璐 wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!
分享创造价值,您的支持将鼓励我继续前行!