New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.9-RC8+ silently stops script when inserting in loop #1119

Closed
oschrenk opened this Issue Jun 29, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@oschrenk

oschrenk commented Jun 29, 2016

I have a small migration script that basically transforms a bit of data from one collection and pumps it one by one into a different collection.

With 0.9-RC7 this script inserts all documents, starting with 0.9-RC8 this script fails silently. Most of the times it stops at around 128 insertions.

// we are only interested in signups less than ~3 months
var cursor = db.things.find({});

function insert(item) {
  // transform things
  // ... removed code ...

  var result = db.differentthings.insert({
    "request": item
  }, {"w":1});
  print("done");

  return result;
};

cursor.forEach( function(item) {
  try {
    insert(item);
  } catch(err) {
    print(err);
  }
});

Sample output from execution

...
Inserted 1 record(s) in 107ms
done
Inserted 1 record(s) in 112ms
done

It even prints done. So insertion works but I know for sure that cursor is not exhausted.

@oschrenk oschrenk changed the title from Robomongo silently stops script after inserting to 0.9-RC8+ silently stops script after inserting Jun 29, 2016

@oschrenk oschrenk changed the title from 0.9-RC8+ silently stops script after inserting to 0.9-RC8+ silently stops script when inserting in loop Jun 29, 2016

@juliashibalko

This comment has been minimized.

Show comment
Hide comment
@juliashibalko

juliashibalko Jun 29, 2016

Collaborator

Hi @oschrenk, thank you for reporting! I was able to reproduce it. We will fix it in the nearest releases, but let me offer you to track progress with this ticket #1106 Scripts end prematurely and randomly when using loop
Feel free to reopen in case of any questions. We will get back to you as issue'll be fixed.

Collaborator

juliashibalko commented Jun 29, 2016

Hi @oschrenk, thank you for reporting! I was able to reproduce it. We will fix it in the nearest releases, but let me offer you to track progress with this ticket #1106 Scripts end prematurely and randomly when using loop
Feel free to reopen in case of any questions. We will get back to you as issue'll be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment