Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support-specify business field as _id value #227

Open
landon30 opened this issue Apr 29, 2020 · 3 comments
Open

support-specify business field as _id value #227

landon30 opened this issue Apr 29, 2020 · 3 comments

Comments

@landon30
Copy link

landon30 commented Apr 29, 2020

Describe the feature

  1. in our business,we have the unique id generator.
  2. we want to use the generated id as the mongo collection _id
  3. we support this?

Use cases

as above

Contribution

@landon30 landon30 added the enhancement New feature or request label Apr 29, 2020
@karianna karianna added enhancement question and removed enhancement New feature or request enhancement labels Apr 29, 2020
@karianna
Copy link
Contributor

Hi @landon30 - that's more of a fundamental MongoDriver ask than it is of the vertex client to that driver. I'd ask over at MongoDB.

@landon30
Copy link
Author

landon30 commented Apr 29, 2020

Hi @landon30 - that's more of a fundamental MongoDriver ask than it is of the vertex client to that driver. I'd ask over at MongoDB.

you can see spring-data mongodb

  • A field annotated with @id (org.springframework.data.annotation.Id) will be mapped to the '_id' field.
  • A field without an annotation but named id will be mapped to the '_id' field.

i think some api usage an refer to spring-data mongodb

@felrugo
Copy link

felrugo commented Aug 3, 2020

Hi @landon30
As I see, the mongo driver supports custom Id field.
You can put the custom generated id into the _id field of the inserted document.
You can also use another field as Id by creating an index to that field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants