Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-731

without cluster: not authorized on <db name> to execute command { aggregate:...

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.0
    • Affects Version/s: 2.1.21
    • Component/s: MongoDB 3.2
    • Environment:

      I'm running my API method collecting everyday statistic simultaneously for 20 days (20 times):

      	this.collection.aggregate(
      		{
      			$group: {
      				_id: {
      					"active": "$enable"
      				},
      				count: { $sum: 1 }
      			}
      		},
      		{
      			$project:{
      				"active": "$_id.active",
      				"_id": 0,
      				"count": 1
      			}
      		}, callback);
      

      During local tests on the workstation I got the next error every time after starting the application:
      errmsg: 'not authorized on <servername> to execute command { aggregate: "tasks", pipeline: [ { $match: { createdTs:

      { $gte: 1464404400, $lt: 1464490799 }

      , type:

      { $in: [ 1, 2, 7 ] }

      } }, { $group: { _id:

      { type: "$type" }

      , count:

      { $sum: 1 }

      } }, { $project:

      { type: "$_id.type", _id: 0, count: 1 }

      } ] }'
      Second and other calls to the API is always succeeded. Then I wait till the number of connections decreases from 5 (default pollSize) to the 2. After this I get this message again for a one time.

      On the server I always have this message for a first time but I didn't find a relation between the error and the number of connections. Just after some delay in requests (3-5 mins) I get the error for a first time and the other requests are succeed.

      This error is not appearing when I set poolSize: 1.

      Could you tell me what is going wrong with this request or what information I should collect additionally to troubleshoot this error?

      Thank you!

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            asnov Alex Novikov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: