Advertisement
VladNitu

avgFingerprint

May 21st, 2023
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. db.rares_news_collection.aggregate([
  2. {
  3. $project: {
  4. _id: 0,
  5. fingerprintSize: {
  6. $cond: [
  7. { $isArray: "$fingerprints" },
  8. { $size: "$fingerprints" },
  9. 0
  10. ]
  11. }
  12. }
  13. },
  14. {
  15. $group: {
  16. _id: null,
  17. avgFingerprintSize: { $avg: "$fingerprintSize" }
  18. }
  19. },
  20. {
  21. $project: {
  22. _id: 0,
  23. avgFingerprintSize: 1
  24. }
  25. }
  26. ])
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement