Skip to content
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
Closed

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

oschrenk opened this issue Jun 29, 2016 · 1 comment
Labels

Comments

@oschrenk
Copy link

@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 Robomongo silently stops script after inserting 0.9-RC8+ silently stops script after inserting Jun 29, 2016
@oschrenk oschrenk changed the title 0.9-RC8+ silently stops script after inserting 0.9-RC8+ silently stops script when inserting in loop Jun 29, 2016
@juliashibalko
Copy link
Collaborator

@juliashibalko 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.