java如何在推送时对mongodb中的数组元素进行排序?
我试图补充这一点。但它现在正在工作
`文档过滤器=新文档();
滤器附加(“Pid”,id)
Document update1 =new Document();
update1.append("$push", new Document("Marks",marksObtain));
coll.updateOne(filter, update1);
Document update2=new Document();
Document update3=new Document();
update3.append("$each", "[]").append("$sort", 1);
update2.append("$push", new Document("Marks",update3));
coll.updateOne(filter, update2);`
共 (0) 个答案