You are viewing a single comment's thread from:

RE: Mongodb数据库快速开发

in #starnote • 13 hours ago

文档 |

const userSchema = new Schema({
  email: { type: String, required: true, unique: true },
  registeredAt: { type: Date, index: true }
});

// [ [ { email: 1 }, { unique: true, background: true } ],
//   [ { registeredAt: 1 }, { background: true } ] ]
// userSchema.indexes();