Changeset 33787 for other-projects


Ignore:
Timestamp:
2019-12-10T20:36:30+13:00 (4 years ago)
Author:
ak19
Message:

Documented another mongodb query that I'm using, the one to produce the map data that Dr Bainbridge wanted for ALL the sites (not just the ones that have /mi/ in the url).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/maori-lang-detection/MoreReading/mongodb.txt

    r33722 r33787  
    483483
    484484# 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()
     4850db.getCollection('Websites').find({urlContainsLangCodeInpath:true, geoLocationCountryCode: {$ne : "NZ"} }).count()
    486486148
    487487
     
    542542
    543543
     544    # count of all sites for which the geolocation is UNKNOWN
     545    db.getCollection('Websites').find({geoLocationCountryCode: {$eq:"UNKNOWN"}}).count()
     546
     547
    544548# AGGREGATION QUERIES THAT WORK:
    545549#https://stackoverflow.com/questions/14924495/mongodb-count-num-of-distinct-values-per-field-key
     550
     551WORKS:
     552// count of country codes for all sites
     553db.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
     566WORKS:
     567// count of country codes for sites that have /mi(/) in path
    546568
    547569db.Websites.aggregate([
Note: See TracChangeset for help on using the changeset viewer.