Arrays MongoDB.Driver.MongoWriteException:&x27;写入操作导致错误。无法索引并行数组'; [BsonId] [BsonRepresentation(BsonType.ObjectId)] 公共字符串Id{get;set;} [BsonElement(“Prop01”)] 公共int Prop01{get;set;} [BsonElement(“Prop02”)] 公共int Prop02{get;set;} [BsonElement(“Prop03”)] 公共字符串[]Prop03{get;set;} [BsonElement(“Prop04”)] 公共列表Prop04{get;set;}

Arrays MongoDB.Driver.MongoWriteException:&x27;写入操作导致错误。无法索引并行数组'; [BsonId] [BsonRepresentation(BsonType.ObjectId)] 公共字符串Id{get;set;} [BsonElement(“Prop01”)] 公共int Prop01{get;set;} [BsonElement(“Prop02”)] 公共int Prop02{get;set;} [BsonElement(“Prop03”)] 公共字符串[]Prop03{get;set;} [BsonElement(“Prop04”)] 公共列表Prop04{get;set;},arrays,mongodb,indexing,nosql,parallel-arrays,Arrays,Mongodb,Indexing,Nosql,Parallel Arrays,我在mongoDB中使用C#(Dot Net Core)插入上述结构/模型,但收到以下异常: **MongoDB.Driver.MongoWriteException:'写入操作导致错误。 无法索引并行数组[Prop03][Prop04]' 内部异常 MongoBulkWriteException`1:大容量写入操作导致一个或多个错误。 无法索引并行数组[Prop03][Prop04]** 我不知道我收到上述异常的原因 我已经尝试了过去两天的不同技巧,但没有成功。问题终于解决了 我并行地对数组和

我在mongoDB中使用C#(Dot Net Core)插入上述结构/模型,但收到以下异常:

**MongoDB.Driver.MongoWriteException:'写入操作导致错误。 无法索引并行数组[Prop03][Prop04]'

内部异常 MongoBulkWriteException`1:大容量写入操作导致一个或多个错误。 无法索引并行数组[Prop03][Prop04]**

我不知道我收到上述异常的原因


我已经尝试了过去两天的不同技巧,但没有成功。

问题终于解决了

我并行地对数组和列表字段应用数据库索引,这在MongoDB中是不允许的

[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string Id { get; set; }

[BsonElement("Prop01")]
public int Prop01{ get; set; }

[BsonElement("Prop02")]
public int Prop02{ get; set; }

[BsonElement("Prop03")]
public string[] Prop03{ get; set; }

[BsonElement("Prop04")]
public List<Test> Prop04{ get; set; }