Skip to content

Instantly share code, notes, and snippets.

@vanleantking
Created April 7, 2023 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanleantking/912643b76e1b12b658ec775c27f54944 to your computer and use it in GitHub Desktop.
Save vanleantking/912643b76e1b12b658ec775c27f54944 to your computer and use it in GitHub Desktop.
sum filter nan mongodb aggregate
db.getCollection("fb_report_detail").aggregate([
{"$match":{
"campaign_id":{"$in":["23852528555800329"]},
"adset_id":{"$in":["23852528555870329","23852661751140329"]}}},
{ '$group': {
'_id': '$ad_id',
'inline_link_clicks': {
'$sum': {
'$cond': [
{ '$eq': ['$inline_link_clicks', NaN]},
0,
'$inline_link_clicks'
]
}
}
}},
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment