Error while creating an admin user in replica set I have a relatively simple replica set test setup between two VMs and my host machine, with VM1 as primary, VM2 as secondary and the host as arbiter. I have mongodb 2.6.4 installed on all machines. So far it works without any issue, however things go weird when I try to setup authentication. For now it is disabled, and I am just trying to create an admin user so that I can set auth to true and set the keyFile in the configuration.
I run the following commands on the primary (VM1):

use admin
db.createUser(
  {
  user: "admin",
  pwd: "blop",
  roles:
    [
      {
        role: "userAdminAnyDatabase",
        db: "admin"
      }
    ]
  }
)


However when I do that (on the primary, not the secondary), the secondary (VM2) crashes after throwing this error:

ERROR: error: exception cloning object in admin.system.users system.users entry must have either a 'pwd' field or a 'userSource' field, but not both obj:{ _id: "admin.admin", user: "admin", db: "admin", credentials: { MONGODB-CR: "85bc114ccxf991158fd4x8eb134834d8" }, roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] }

What am I doing wrong?

Thanks in advance

EDIT: I found the issue, actually for some reason the mongod instance on VM2 was still on 2.4, which has an incompatible way of creating users and would crash when receiving new-style user data from the primary.
I found the issue, actually for some reason the mongod instance on VM2 was still on 2.4, which has an incompatible way of creating users and would crash when receiving new-style user data from the primary. I just fixed it by upgrading MongoDB on VM2