我必须管理一个带有评论的墙,每个墙有很多父评论,每个父评论都有子评论。
我的收藏集墙就是这样
col A==b
和集合评论就是这样
C D
0 x 4
1 y 1
2 z 2
我想按父母的评论显示墙,每个孩子的评论都在其父母的评论之下。
但是mongo db中的结果并非一直都在排序,排序似乎是随机的,
1-如何使用字段(childs.createdAt)对childs数组进行排序
2-如何仅在子代(_id / date / createdAt)下显示这些字段,并在数组注释下显示这些字段(_id / childs / date)。
查询
listen 443 default_server;
listen [::]:443 default_server;
server_name example.com www.example.com;
root /home/ubuntu/client/build;
location / {
try_files $uri /index.html;
}
location /complete {
proxy_pass https://www.example.com;
}
# managed by Certbot
ssl on;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
# managed by Certbot
}
server {
if ($host = www.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 0.0.0.0:80;
server_name example.com www.example.com;
rewrite ^ https://$host$request_uri? permanent;
}
数据
https://mongoplayground.net/p/XTu0yeLTMMr
如何修改查询?谢谢。