Can't Migrate Mongodb from version 3.4 to 3.6 using Meteor 1.2.0.2

116 views Asked by At

We need to migrate our current Mongodb 3.4 to version 3.6 but the recommendations don't work. Mongo says that you need to send the cursor option in aggregates, which I am doing like: someCollection.aggregate(pipeline, {cursor: {}}). Our aggregates work well using mongodb 3.4, but when trying to run them in 3.6, they don't work. The app is written with Meteor framework, version 1.2.0.2

The packages related to Mongodb are:

  1. dburles:[email protected]
  2. [email protected]
  3. [email protected]
  4. [email protected]
  5. [email protected]
  6. [email protected]_1

The pipeline for this example is:

let pipeline = [
  {$match: {'contractor._id': contractorId, _id: {$ne: apptId}, start: {$lte: appt.start}}},
  {$unwind: '$notes'},
  {$sort: {start: -1, 'notes.creationDate': 1}}
];

Following are the options I've tried

#1:

    var result = SalesAppointment.aggregate(pipeline, {cursor: {}});
    return result;

#2:

    var result = SalesAppointment.aggregate(pipeline, {cursor: {}});
    return result.toArray();

#3:

    var result = SalesAppointment.aggregate(pipeline, {cursor: {}});
    return new Promise(function (resolve, reject) {
      resolve(result.toArray());
    });

#4:

    var result = SalesAppointment.aggregate(pipeline, {cursor: {}});
    return new Promise(function (resolve, reject) {
      resolve(result);
    });

#5:

    let rawCol = SalesAppointment.rawCollection();
    let aggregateQuery = Meteor.wrapAsync(rawCol.aggregate, rawCol);
    return aggregateQuery(pipeline, {cursor: {}});

#6:

    var result = SalesAppointment.rawCollection().aggregate(pipeline, {cursor: {}});
    return result;

// RESULT #1 to #5: All the options make the app to hang, it never gets to the return statement, and client never gets the promise resolved.

// RESULT #6: It returns an object with no data to the frontend, it only has these properties: _readableState, readable, domain, _events, _maxListeners. In the backend it has these methods: explain, get, getOne, each, next, close, _read.

Thanks for your help.

0

There are 0 answers