nightroman / Mdbc

MongoDB Cmdlets for PowerShell
Apache License 2.0
141 stars 16 forks source link

Add-MdbcData example results in Duplicate Key error #58

Closed awsles closed 3 years ago

awsles commented 3 years ago

The Add-MdbcData example in the README.md results in a duplicate key error:

# Remove any existing documents to be sure
@{_id = 1}, @{_id = 2} | Remove-MdbcData

# Add two documents
@{_id = 1; value = 42}, @{_id = 2; value = 3.14} | Add-MdbcData

The Add-MdbcData throws the error: _E11000 duplicate key error collection: fe.systemconfigurations index: configId1 dup key: { configId: null }. The expected behavior is to add the two documents. In viewing the collection, the first document is written, but the second document is not.

image

awsles commented 3 years ago

Ahhh my mistake. D'oh. A second index existed in the collection.