mongodb

Count with WHERE condition

I have the following T-SQL query :
SELECT year, COUNT(*) FROM publis
WHERE publisher LIKE ‘%Springer%’

I made this query :
db.publis.aggregate([{"$group" : {_id:"$year", count:{$sum:1}}}])

How can I include the WHERE …

Mongodb: $round decimal

I’m trying to round the average salary to 2 decimal places. I’m stumped, I can get either everyones salary to 2 decimal places
db.employees.aggregate([{$project: {_id: null, ’roundedSal’:{$round: [{$avg: ‘$salary’}]}}}])

which returns

{ …

No space left repair

One of the shards overflowed and crashed. Now I am trying to repair it, but it cannot repair it because no space left, see below.
2021-04-16T16:32:09.402+0000 W STORAGE [initandlisten] Failed to start up WiredTiger under any compatibilit…