Changeset 33787 for other-projects/maori-lang-detection/MoreReading
- Timestamp:
- 2019-12-10T20:36:30+13:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/maori-lang-detection/MoreReading/mongodb.txt
r33722 r33787 483 483 484 484 # Number of websites that are outside NZ that contain /mi(/) in any of its sub-urls 485 db.getCollection('Websites').find({urlContainsLangCodeInpath:true, geoLocationCountryCode: {$ne : "NZ"} }).count()485 0db.getCollection('Websites').find({urlContainsLangCodeInpath:true, geoLocationCountryCode: {$ne : "NZ"} }).count() 486 486 148 487 487 … … 542 542 543 543 544 # count of all sites for which the geolocation is UNKNOWN 545 db.getCollection('Websites').find({geoLocationCountryCode: {$eq:"UNKNOWN"}}).count() 546 547 544 548 # AGGREGATION QUERIES THAT WORK: 545 549 #https://stackoverflow.com/questions/14924495/mongodb-count-num-of-distinct-values-per-field-key 550 551 WORKS: 552 // count of country codes for all sites 553 db.Websites.aggregate([ 554 555 { $unwind: "$geoLocationCountryCode" }, 556 { 557 $group: { 558 _id: "$geoLocationCountryCode", 559 count: { $sum: 1 } 560 } 561 }, 562 { $sort : { count : -1} } 563 ]); 564 565 566 WORKS: 567 // count of country codes for sites that have /mi(/) in path 546 568 547 569 db.Websites.aggregate([
Note:
See TracChangeset
for help on using the changeset viewer.