These are chat archives for Automattic/mongoose

Oct 2017
Paul "Joey" Clark
Oct 13 2017 06:37
@pantchox I would query first to get the IDs. Then remove the IDs I just queried.
I would feel cleaner removing the Cs first, then the Bs, then the A.
Vlado Tesanovic
Oct 13 2017 09:13
@jemliF i can't find your original message to see your code
Oct 13 2017 09:40
Anyone who has a backend project in mind,but needs a front end guy to complete the project,then pm me,I'll gladly take it.
Peter Bailey
Oct 13 2017 12:04
mongoose.Promise = global.Promise;
  .createConnection(process.env.MONGODB_CONNECTION_STRING, {
    useMongoClient: true
  .then(() => {
    const user = new User();
        stravaCode: req.query.code,
      {upsert: true},
      err => {
  .catch(err => {
Anyone had "TypeError: user.findOneAndUpdate is not a function" before? Can’t see any problems with my code.
Nick Rameau
Oct 13 2017 15:00
@pea Just use User.findOneAndUpdate, unless you really need to use the object user later, I don't think it will work your way.
Supposing User is your model.
Peter Bailey
Oct 13 2017 15:18
Mmm well that error has disappeared. No document but I’m guessing that’s another problem. Thanks
Peter Bailey
Oct 13 2017 20:00
Is the documentation just out of date? The docs are telling me one thing, the error log is telling me another