Search code examples
arraysmongodbindexingnosqlparallel-arrays

MongoDB.Driver.MongoWriteException: 'A write operation resulted in an error. cannot index parallel arrays'


[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; }

I'm inserting above structure/model in mongoDB using C# (Dot Net Core), but I'm receiving following exception:

**MongoDB.Driver.MongoWriteException: 'A write operation resulted in an error. cannot index parallel arrays [Prop03] [Prop04]'

Inner exception MongoBulkWriteException`1: A bulk write operation resulted in one or more errors. cannot index parallel arrays [Prop03] [Prop04]**

I don't know the reason why I'm receiving above exception.

I already tried different tricks from last two days but not succeeded.


Solution

  • Finally problem resolved!

    I was applying database indexing on Array and List fields in Parallel, which is not allow in MongoDB.