Index of username_1 gets created in mongoDB although no username in the Schema/Model

问题内容:

Hello, I hope this question ain’t stupid, but I have a problem with Nodejs/mongoose/MongoDB.

var SportsSchema = new Schema({
title: String,
internalTitle : String,
semester : String ,
uniqueIdent : { type : String, unique : true, index : true },
sportsType: String,
kindOfSport: String,
description: String,
location: String,
numberOfParts: Number,
recurrence: String,
weekDay1: {type: String, default: 'empty'},
weekDay2: {type: String, default: 'empty'},
startTime1: {type: String, default: 'empty'},
startTime2: {type: String, default: 'empty'},
sportDates: [{
  type: Date
}],
specDates: [{
  type: String
}],
timeFrame: [{
  type: Date
}],
created: {type: Date, default: Date.now },
});

This is the Schema. Only uniqueIdent is unique and indexing. As soon as the nodeJS app starts, the mongoDB collection has the following indexes: _id, uniqueIdent and username. While the first two are expected, the third one is flabbergasting me.

There is a username in the other schema that i am using, but that shouldn’t influence this one, should it.

Any help would be appreciated, if more information is necessary, I will happily provide it.

other schema:

var UserSchema = new Schema({
username: {type: String, lowercase: true, unique: true, match: [/\S+@\S+\.\S+/, 'ist nicht erlaubt']},
email: {type: String, lowercase: true, unique: true, match: [/\S+@\S+\.\S+/, 'ist nicht erlaubt']},
firstname :String,
lastname: String,
password: String,
//admin: {type: Boolean, default: false },
permissionLevel: {type: String, default: 'user' },
tr_tmp: {type: Boolean, default: 'false'},
classOne: {type: String, default : 'empty' },
classTwo: {type: String, default : 'empty' },
classThree: {type: String, default : 'empty' }
});

问题评论:

    
How does you other schema look?
    
Other schema provided
– Flowgram
3 hours ago
    
Managed to solve it, was a silly mistake by myself! sorry to bother you!
– Flowgram
1 hour ago

原文地址:

https://stackoverflow.com/questions/47753262/index-of-username-1-gets-created-in-mongodb-although-no-username-in-the-schema-m

添加评论

友情链接:蝴蝶教程