MongoDB
 sql >> Cơ Sở Dữ Liệu >  >> NoSQL >> MongoDB

Dự án dưới dạng tài liệu lồng nhau trong Spring mongo

Bạn có thể sử dụng tổng hợp bên dưới.

AggregationOperation project = Aggregation.project().
         and("Contrat").nested(Fields.fields("Field1","Field2")).
         and("Formule").nested(Fields.fields("Field3","Field4"));
AggregationOperation project2 = Aggregation.project().
         and("Contrats").nested(Fields.fields("Contrat","Formule")).
AggregationOperation out = Aggregation.out("test");

Aggregation aggregation = Aggregation.newAggregation(project, project2, out);
mongoTemplate.aggregate(aggregation, "<nameOfInitialCollection>", Class.class);



  1. Redis
  2.   
  3. MongoDB
  4.   
  5. Memcached
  6.   
  7. HBase
  8.   
  9. CouchDB
  1. Đọc và hiển thị hình ảnh từ mongoDB bằng GridFs

  2. Chuyển đổi truy vấn Mongo sang Laravel, elemMatch lồng nhau

  3. Bắt đầu với PHP và MongoDB

  4. Mongoose hết thời gian và ném ngoại lệ

  5. làm thế nào để tìm trường riêng biệt của một mô hình dựa trên một và điều kiện trong mongoose?