JavaScript IDs in quotes when using MongoDB $setEquals quotes using when,quotes using periodic table elements,quotes using

I've got a problem with quoted IDs in referenced array. When I try this:

Task.find({ game: req.user.game }).exec(function(err, task) {
    if(err) {
        console.log(err);
    } else {
        console.log(task[0].inCategories);
    }
});

it writes an array of IDs in quotes to node.js console (["5550a9604b24bcdc1b88cc76", "5551213c35d0516807b2cd99"]). But then I'm trying to return Task for a logged in user (look at the comments next to console.log commands):

Profession.find({ _id: req.user.profession }).exec(function(err, profession) {
    if(err) {
        return res.status(400).send({
            message: errorHandler.getErrorMessage(err)
        });
    } else {
        console.log(profession[0].assignedTaskCategories); // output: array with quoted IDs
        var pipeline = [
            {
                '$match': { 'game': req.user.game,  }
            },
            {
                '$project': { 
                    'title': 1,
                    'game': 1, 
                    'inCategories': 1, 
                    'sameElements': { 
                        '$setEquals': [ '$inCategories', profession[0].assignedTaskCategories ] 
                    }
                }
            }
        ];
        Task.aggregate(pipeline).exec(function (err, tasks){
            if(err) {
                return res.status(400).send({
                    message: errorHandler.getErrorMessage(err)
                });
            } else {
                console.log(tasks[0].inCategories); //array with IDs without quotes
                res.json(tasks);
            }
        });
    }
});

Value of sameElements is false, because $setEquals compares arrays, one with quoted IDs, one without quotes and I don't know why it's happening???

Answer:1

Currently looking tot speed up a manual task. I have several web URLS in a .txt file that I'm hoping to add to a line of code for each URL. The code is: <tr> <td><a href="">&...

Currently looking tot speed up a manual task. I have several web URLS in a .txt file that I'm hoping to add to a line of code for each URL. The code is: <tr> <td><a href="">&...

  1. create batch file windows 10
  2. create batch file to copy files
  3. create batch file to run powershell script
  4. create batch file linux
  5. create batch file to map network drive
  6. create batch file to delete files
  7. create batch file to move files
  8. create batch file to add registry key
  9. create batch file to run as administrator
  10. create batch file to run exe
  11. create batch file to run cmd as administrator
  12. create batch file with parameters
  13. create batch file windows 7
  14. create batch file to uninstall application
  15. create batch file to rename files
  16. create batch file on mac
  17. create batch file to install software
  18. create batch file for powershell
  19. create batch file to run python script
  20. create batch file from cmd

var x = 9; var mod = { x: 81, assign: function(){ this.x = 9; x = 3; }, checkVars: function(){ alert(x + " - " + this.x ); } }; mod.checkVars(); //9 - 81 ...

var x = 9; var mod = { x: 81, assign: function(){ this.x = 9; x = 3; }, checkVars: function(){ alert(x + " - " + this.x ); } }; mod.checkVars(); //9 - 81 ...

i'm trying to match a *xxx pattern such as "*test", "*love" "*anything" (like hashtag) i basically tried: "*aaa *eee *rrr *ttt".match(/(\s|^)(\*[a-z0-9]{3,150})(\s|$)/img) returns only odd logical ...

i'm trying to match a *xxx pattern such as "*test", "*love" "*anything" (like hashtag) i basically tried: "*aaa *eee *rrr *ttt".match(/(\s|^)(\*[a-z0-9]{3,150})(\s|$)/img) returns only odd logical ...

Hi guys i am using node server for data fetch and and client side is my ionic framework for android application(phonegap). so in my computer browser i hit localhost:8080/sessions (or 10.129.86.47:...

Hi guys i am using node server for data fetch and and client side is my ionic framework for android application(phonegap). so in my computer browser i hit localhost:8080/sessions (or 10.129.86.47:...

  1. ionic cross domain issue
  2. ionic cross domain
  3. ionic cross domain request
  4. ionic http get cross domain