question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unique index on idField?

See original GitHub issue

Should 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:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
joshuajabbourcommented, Jun 9, 2016

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.

1reaction
dafflcommented, Jun 9, 2016

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found