1

I'm a beginner in node.js

So, I used this to

  var toFix = {
    'renault': 'Renault',
    'renault ': 'Renault',
    'RENAULT ': 'Renault',
    'RENAULT': 'Renault',
};

  async.forEachOfSeries(toFix, function(to, from, cb){
    Car.update({make:from }, {$set: {make: to}}, {multi: true},cb)
  }, done);

and it worked for my table car.

but when I want to use the same code in an other table, where car is an object in a table, It doesn't work, for exemple:

async.forEachOfSeries(toFix, function(to, from, cb){
        Ticket.update({car.make:from }, {$set: {car.make: to}}, {multi: true},cb)
      }, done);

it can't accept car.make . so how should I access to my object?

Thanks

1 Answer 1

2
async.forEachOfSeries(toFix, function(to, from, cb){
    Ticket.update({'car.make':from }, {$set: {'car.make': to}}, {multi: true},cb)
  }, done);

Change car.make to 'car.make'

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.