Unique index on idField?
See original GitHub issueShould this adapter create a unique index on the idField
(if it’s not _id
)? Or should that be up to the user to do manually out-of-band? Right now, if you set the idField to something else (like id
), you can create multiple/duplicate documents with that id.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:7 (7 by maintainers)
Top Results From Across the Web
How have unique indexes on geodatabase-managed Global ...
Add Global ID now creates a unique index on the Global ID field to preserve uniqueness across features in the underlying table or...
Read more >MySql `id` column has a 'PRIMARY' and a 'UNIQUE' index, is ...
I always make it PRIMARY KEY, NOT NULL, UNIQUE, AUTO_INCREMENT . I'm recently getting big into adding custom indexes and I've noticed that...
Read more >Unique index in CI ID field of AST:Computer System form
Hi Elizabeth,. Unable to create Unique index for CI ID field in AST:Computer system form? But still duplicate entries are being created.
Read more >Unique Indexes — MongoDB Manual
A unique index ensures that the indexed fields do not store duplicate values; i.e. enforces uniqueness for the indexed fields. By default, MongoDB...
Read more >.NET Open Client does not consider the Locale on a unique ...
The dataset is defined as follows: DEFINE TEMP-TABLE ttmyfields FIELD IDField AS CHARACTER FIELD DescriptionField AS CHARACTER INDEX IDField AS ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, we can check for the index, and I do think we should throw if there isn’t one. Adding the index should be required, otherwise it’s not actually an id field. I’ll put together a PR.
I was just replying and then @marshallswain beat me to it.
We changed the adapters from doing all the connection and collection setup stuff themselves to just passing the initialized collection. I agree that it makes sense to have the user do it but we should mention it in the docs. Is there maybe also a way to check if there is a unique index on the passed id field and throw a warning?