mongoDB的使用

1. MongoDB的分组查询 : group by...

db.table_job.aggregate({"$group":{_id: '$sqlModelName',max_value:{"$max":"$createTime"}}});

table_job ----->document name      

转化成SQL:

select sqlModelName,max(createTime)

from table_job

group by sqlModelName;

2. MongoDB的筛选条件 排序  限制记录数  where...  order by...  limit ...

db.table_job.find({'createTime':{"$gt":'2019-08-23 13:57:29:299'}}).projection({}).sort({ _id: -1 }).limit(1000);

select *

from table_job

where createTime>'2019-08-23 13:57:29:299' 

order by _id desc

limit 1000;

 

转载于:https://www.cnblogs.com/zoey12/p/11414279.html

你可能感兴趣的:(mongoDB的使用)