MongoDB query to try multiple cases using aggregate, $group, $switch…returning error Unrecognized pipeline stage name: ‘$switch’

MongoDB query to try multiple cases using aggregate, $group, $switch…returning error Unrecognized pipeline stage name: ‘$switch’

Using MongoDB aggregate to see if a first field and/or a second field have value(s), and if so, to increment the NumberMatches by either 1 or 2 (depending on whether one or both exampleA and exampleB have values), and to increment MatchesTotal by the values of exampleA/exampleB. I am using Mongo’s $switch, as with this example from Stack Overflow, and $group.

However, I am getting the error message Unrecognized pipeline stage name: '$switch'. Right now the $switch is outside of $group. Previously I had tried using the $switch within MongoDB $group to try the query, but got another error message unknown group operator '$switch'. How can I use $switch and $group together in order to do this incrementation/sum ternary query in MongoDB?

$switch query with $group inside:

db.examples.aggregate([
  {
    "$match": {
      $or : [
        { 
          $and : [ 
            {"exampleField.exampleA": {$type: 16}},
            {"exampleField.exampleB": { $type: 16 }}
          ]
        },
        { 
          "exampleField.exampleA": {$type: 16}
        },
        { 
          "exampleField.exampleB": {$type: 16}
        }               
      ]
    }
  },    
  {
    $switch: {
      "branches": [
        { "case": 
          { "$eq": [ "$exampleField.exampleA", null ] }, 
          "then": { 
            $group: {
              _id: null,
              NumberMatches: { $sum: 1 },
              MatchesTotal: { $sum: "exampleField.exampleB" }
            }
          }
        },
        { "case": { 
          "$eq": [ "exampleField.exampleB", null ] }, 
          "then": {     
            $group: {
              _id: null,
              NumberMatches: { $sum: 1 },
              MatchesTotal: { $sum: "$exampleField.exampleA" }
            } 
          }
        }
      ],
      "default": {     
        $group: {
          _id: null,
          NumberMatches: { $sum: 2 },
          MatchesTotal: { $sum: "$exampleField.exampleA" + "exampleField.exampleB" }
        } 
      }      
    }     
  },  
]).forEach( function(myDoc) { print( myDoc) } );

Alternate $group query with $switch inside (also didn’t work):

$group: {
  _id: null,

  NumberMatches: {
      $switch: {
          "branches": [
              { "case": { "$eq": [ "$exampleField.exampleA", null ] }, "then": { $sum: 1 } },
              { "case": { "$eq": [ "exampleField.exampleB", null ] }, "then": { $sum: 1 } }
            ],
        "default": { $sum: 2 }

      }

  },      
  MatchesTotal: { $sum: "$exampleField.exampleA" + "$exampleField.exampleB" }
}

Go to Source
Author: maudulus

Trying to upgrade to a new release version, having trouble with /etc/apt/sources.list

Trying to upgrade to a new release version, having trouble with /etc/apt/sources.list

I am trying to upgrade to a new release version following the instructions of the accepted answer here.

Someone mentioned in the comments section of the OP’s question that you should change http://old-releases.ubuntu.com/ubuntu/ to http://us.archive.ubuntu.com/ubuntu/
so that’s what I did. The current state of my sources.list file is as shown below.

enter image description here
enter image description here

When I try to run sudo apt-get update && sudo apt-get dist-upgrade, I get

Ign:1 http://us.archive.ubuntu.com/ubuntu disco InRelease
Hit:2 http://packages.microsoft.com/repos/vscode stable InRelease                                                            
Ign:3 http://us.archive.ubuntu.com/ubuntu disco-updates InRelease                                                            
Hit:4 http://dl.google.com/linux/chrome/deb stable InRelease                              
Hit:5 https://repo.skype.com/deb stable InRelease                                         
Ign:6 http://us.archive.ubuntu.com/ubuntu disco-backports InRelease                       
Hit:7 http://ppa.launchpad.net/bit-team/stable/ubuntu disco InRelease
Ign:8 http://us.archive.ubuntu.com/ubuntu disco-security InRelease
Err:9 http://us.archive.ubuntu.com/ubuntu disco Release                            
  404  Not Found [IP: 91.189.91.39 80]
Err:10 http://us.archive.ubuntu.com/ubuntu disco-updates Release                   
  404  Not Found [IP: 91.189.91.39 80]
Err:11 http://us.archive.ubuntu.com/ubuntu disco-backports Release
  404  Not Found [IP: 91.189.91.39 80]
Err:12 http://us.archive.ubuntu.com/ubuntu disco-security Release
  404  Not Found [IP: 91.189.91.39 80]
Ign:13 http://ppa.launchpad.net/pmcenery/ppa/ubuntu disco InRelease
Err:14 http://ppa.launchpad.net/pmcenery/ppa/ubuntu disco Release
  404  Not Found [IP: 2001:67c:1560:8008::15 80]
Reading package lists... Done
E: The repository 'http://us.archive.ubuntu.com/ubuntu disco Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://us.archive.ubuntu.com/ubuntu disco-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://us.archive.ubuntu.com/ubuntu disco-backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://us.archive.ubuntu.com/ubuntu disco-security Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ppa.launchpad.net/pmcenery/ppa/ubuntu disco Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

What should I do?

Go to Source
Author: An Ignorant Wanderer

Install driver rtl8814au on ubuntu 20.04

Install driver rtl8814au on ubuntu 20.04

Based on this

Install driver rtl8814au on ubuntu 18.04

I installed manually (make && make install) the driver when I had the kernel

$ uname -r
5.4.0-26-generic

Now, ubuntu 20.04 wants to install the new one:

linux-image-5.4.0-29-generic

I did it before (upgrade the system then, the kernel) and the driver stopped to work, even I installed thousand times, was impossible to up the driver which logical name is “wlx50c4ddcf488e”.

The installation I made:

$ sudo apt install build-essential
$ sudo apt install bc
$ sudo apt install linux-headers-`uname -r`
$ sudo apt install git

$ git clone https://github.com/aircrack-ng/rtl8812au.git

$ cd rtl8812au
$ make && sudo make install

Does anyone has idea about what can I do? Now, I cannot upgrade my system without losing the wireless connection.

Thank a lot.

Go to Source
Author: Ibringpies