MongoDB C# Unique field giving error with values that don't exists -


so, i've field mongodb declared unique, reasons, if gives error after inserting second record, saying "unique" field used.

this code create index.

var tablenumber = new stringfielddefinition<table>("number"); var tablenumberindexdefinition = new indexkeysdefinitionbuilder<table>().ascending(tablenumber); tables.indexes.createoneasync(tablenumberindexdefinition, options); 

this exception get:

"a write operation resulted in error.\r\n  e11000 duplicate key error collection: restovationdb.tables index:number_1 dup key: { : null }]", 

when insert first entity have no problems when try inserting second one, gives me exception above, ideas ?


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -