MongoDB
 sql >> Teknologi Basis Data >  >> NoSQL >> MongoDB

Menggunakan banyak aspek dalam Data Musim Semi MongoDB

Anda dapat menyambungkan beberapa operasi faset menggunakan .and() dan .as() metode. Anda harus mengganti facet kedua metode dengan and metode seperti di bawah ini.

FacetOperation facets = facet(match(where("entryType").is(EntryType.DEBIT)
        .andOperator(where("currentStatus").is(TransactionStatus.CONFIRMED))),
        unwind("history"),
        match(where("history.status").is(TransactionStatus.CONFIRMED)),
        project().andExpression("history.amount").as("historyAmount"),
        group().sum("historyAmount").as("total"),
        project("total")
).as("totalConfirmedDebits"),
        /*
                 * Summarize Confirmed Credits 
         */
.and(match(where("entryType").is(EntryType.CREDIT)
        .andOperator(where("currentStatus").is(TransactionStatus.CONFIRMED))),
        unwind("history"),
        match(where("history.status").is(TransactionStatus.CONFIRMED)),
        project().andExpression("history.amount").as("historyAmount"),
        group().sum("historyAmount").as("total"),
        project("total")
).as("totalConfirmedCredits")



  1. Redis
  2.   
  3. MongoDB
  4.   
  5. Memcached
  6.   
  7. HBase
  8.   
  9. CouchDB
  1. Bagaimana cara membatasi sumber daya CPU dan RAM untuk mongodump?

  2. kueri luwak/mongodb beberapa jenis

  3. Cara mencadangkan dan memulihkan basis data Mongodb

  4. Sintaks Kueri Berbeda C# MongoDB

  5. Pembaruan sebagian dari subdokumen dengan nodejs/luwak