简体   繁体   中英

MongoDB & Java DBRef Usage

So let's say I have a patient document in MongoDB. It has things such as first name, last name, etc… I am trying to add to the current document a list of providers (which is another collection, by DBRef, as I am using POJO. How would I append multiple providers in Java to the document?

One way to do this is by just appending to a document like this:

Document doc = new Document("user", userObject).append("providers", providersObject);

providersObject would be your list of providers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM