Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-5567

Incorrect shell aggregation syntax in transpiler test

      Problem Statement/Rationale

      The translation of an aggregation using the mongo shell appears incorrect. It provides the following example syntax for an aggregation:

      mongo 'mongodb://localhost:27017' --eval "db = db.getSiblingDB('db');
      db.collection.aggregate({                                            
        'x': new NumberLong(0),                                            
        'y': new ObjectId()                                                
      });"                                                                 
      

      Aggregation should be using a pipeline represented as an array though. Also, this needs the $match stage (assuming this is meant to be a filter).

      Actually executing this yields the following error:

      uncaught exception: Error: command failed: {
      	"ok" : 0,
      	"errmsg" : "A pipeline stage specification object must contain exactly one field.",
      	"code" : 40323,
      	"codeName" : "Location40323"
      } : aggregate failed :
      

      Additional Notes

      While this ticket only covers the shell, the other examples look like they might have the same issue, since none of them specify $match or use arrays for the pipeline. I haven't personally tested them yet though.

      More broadly speaking, it seems like we might want to consider running integration tests using the generated output to ensure they're correct.

            Assignee:
            Unassigned Unassigned
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: