java objectid_如何在java中创建mongoDB objectid

参考

How to add an array to a MongoDB document using Java?后

我用java创建了一个mongo模式

它有子元素,我得到主文件的_id

我想在子元素中得到_id这里输出看起来(我已经标记了我需要的部分_id)b.party.find().pretty();

{

"_id" : ObjectId("5399aba6e4b0ae375bfdca88"),

"addressDetails" : [

{

// _id here

"locationName" : "Office",

"phones" : [

{ // _id here

"name" : "Tel1",

"value" : "95253-"

},

{ // _id here

"name" : "Tel2",

"value" : "95253-"

},

{ // _id here

"name" : "Tel3",

"value" : "95253-"

},

{ // _id here

"name" : "Fax1",

"value" : "0253-"

}

],

"address" : "A-3,MIDCA-3,MIDC",

"defaultBillAddrerss" : "",

"pincode" : "422 010",

"city" : null,

"state" : "1",

"country" : ""

},

{ // _id here

"locationName" : "Factory",

"phones" : [

{ // _id here

"name" : "Tel1",

"value" : "0253-"

},

{ // _id here

"name" : "Tel2",

"value" : "0253-"

},

{ // _id here

"name" : "Tel3",

"value" : "0253-"

},

{ // _id here

"name" : "Fax1",

"value" : "0253-"

}

],

"address" : "A-3 INDUSTRIAL AREA,",

"defaultBillAddrerss" : "",

"pincode" : "422 010",

"city" : null,

"state" : "1",

"country" : ""

}

],

"crLimit" : "0.0",

"crPeriod" : "",

"name" : "CROMPTON GREAVES "

}

是否有任何代码在java中以编程方式创建ObjectId(“”)?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值