Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
500 views
in Technique[技术] by (71.8m points)

javascript - mongoDB query using $match and $group (filter last 24 hours logged data and group with id and count)

what I am trying to do is, filter only last 24 hour logs and group by userId and count how many time it logged

here is my mongoDB collection's schema

Key Type
timestamp(ISODate) Date
... ...
transactionLogs_docs Array
????- [0] Object
????????- userId String
????????- ... ...

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Put $match before $group stage


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...