techfort / LokiJS

javascript embeddable / in-memory database
http:/techfort.github.io/LokiJS
MIT License
6.75k stars 481 forks source link

Make id field configurable per collection #820

Closed jbemmel closed 4 years ago

jbemmel commented 4 years ago

The default '$loki' attribute for object ids may work in some cases, but at times it is necessary to specify a different field name to use, for example to achieve compatibility with existing data models or other backends like MongoDB. This PR makes the name of the ID field configurable per collection, still defaulting to '$loki' but enabling the use of custom field names like '_id'. npm test passes, one additional test case added.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

jahangirabd commented 3 years ago

Useful parameter. Please consider to merge.