lib/command/string.js
function msetnx() {
  var args = slice.call(arguments)
    , i
    , req;

  // got a req object
  if(typeof args[args.length -1] === 'object') {
    req = args.pop();
  }

  for(i = 0;i < args.length;i += 2) {
    if(this.keyExists(args[i], req)) {
      return 0;
    }
  }

  for(i = 0;i < args.length;i += 2) {
    this.setKey(args[i], args[i + 1], undefined, undefined, undefined, req);
  }

  return 1;
}
function msetnx() {
  var args = slice.call(arguments)
    , i
    , req;

  // got a req object
  if(typeof args[args.length -1] === 'object') {
    req = args.pop();
  }

  for(i = 0;i < args.length;i += 2) {
    if(this.keyExists(args[i], req)) {
      return 0;
    }
  }

  for(i = 0;i < args.length;i += 2) {
    this.setKey(args[i], args[i + 1], undefined, undefined, undefined, req);
  }

  return 1;
}
function msetnx ( ) { var args = slice . call ( arguments ) , i , req ; // got a req object if ( typeof args [ args . length - 1 ] === 'object' ) { req = args . pop ( ) ; } for ( i = 0 ; i < args . length ; i += 2 ) { if ( this . keyExists ( args [ i ] , req ) ) { return 0 ; } } for ( i = 0 ; i < args . length ; i += 2 ) { this . setKey ( args [ i ] , args [ i + 1 ] , undefined , undefined , undefined , req ) ; } return 1 ; }
Set multiple keys to multiple values only if none
of the keys already exist.

This is O(N^2) but redis is O(N), not sure how they do that.
Set multiple keys to multiple values only if none of the keys already exist .