function getIDS(commandResult) {
  if (!(commandResult && commandResult.results)) {
    return [];
  }

  return commandResult.results.map(function(z) {
    return z.obj._id;
  });
}

function queryIDS(coll, search, filter, extra) {
  var cmd = {search: search};
  if (filter) {
    cmd.filter = filter;
  }
  if (extra) {
    Object.extend(cmd, extra);
  }
  lastCommandResult = coll.runCommand("text", cmd);

  return getIDS(lastCommandResult);
}
