Java Mongo驱动程序将Id转换为二进制

时间:2019-03-18 17:59:18

标签: mongodb spring-boot mongodb-query mongo-java-driver

我正在尝试使用带有Starter-mongo-driver的Spring Boot应用程序的POST请求将POST请求保存在MongoDB中。我正在尝试对_ID字段使用UUID 但是每次保存时,它使用的查询都会使用此二进制对象

[{ "q" : { "_id" : { "$binary" : { "base64" : "MkNTaisPZXgtBqKMtleKuA==", "subType" : "03" } }  ....

这是我要保存的JSON对象。如何保存在UUID中?

{   
    "name": "QUAREX",
    "description": "Group for all committee members that are responsible for Stucco",
    "users": [
      {
        "userId": "dfb0969a-769b-4ee8-8ee9-d43ca41e8847",
        "displayName": "Wilma Bernard",
        "role": [
          "LIASON"
        ]
      }
    ],
    "applicationCodes": [
      "MOBILUS"
    ],
    "tags": [
      "authoring"
    ]
  } 

0 个答案:

没有答案