简体   繁体   中英

how to create a field for array of DBRef

I'm new to MongoDB. In my java code, I have to define a Document. One of the fields in this Document has to contain an array of DBRef to other Document. How can I create an array of customers? How can it be done? what are the alternatives?

@DBRef
private Customer custId;

Thanks, Eyal.

class DBRef {
    public static void main {String args[]) {
    int customers[][] = new int [7][];
    customers[0] = new int p[];
    customers[1] = new int p[];
    customers[2] = new int p[];
    customers[3] = new int p[];
    customers[4] = new int p[];
    customers[5] = new int p[];
    customers[6] = new int p[];

    int i, j;

You would want to add some data to the Array. Arrays is a collection of variables of the same type, referred to by a common name. They can be one or more dimensions in java. They are use to group together related variables. For example a list of Stock price averages or a list of baseball "sports" stats. The easy ones to learn are 2D Arrays and the basic Array.

for statement

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