Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: throws when the custom id field name is set #568

Merged
merged 1 commit into from
Apr 23, 2020
Merged

Conversation

agnes512
Copy link
Contributor

@agnes512 agnes512 commented Apr 16, 2020

Relates to loopbackio/loopback-next#5042

LB4 mongoDB connector doesn't support custom field name for id properties. However, it doesn't throw or warn if the name is set.

getDatabaseColumnName is the only method to handle custom names. This PR adds some checks and throws if the custom id property name is set.

Checklist

馃憠 Read and sign the CLA (Contributor License Agreement) 馃憟

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • Commit messages are following our guidelines

README.md Outdated
@@ -288,6 +288,39 @@ module.exports = function(app) {
};
```

### Customize collection/field names

loopback-connector-mongodb allows you to have different collection and field names from the models. For example, the following setting would define a collection with custom name `Custom_Collection`, and it has a custom field name `Custom_Content` in the database:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
loopback-connector-mongodb allows you to have different collection and field names from the models. For example, the following setting would define a collection with custom name `Custom_Collection`, and it has a custom field name `Custom_Content` in the database:
nitpick: `loopback-connector-mongodb` allows you to have different collection and field names from the models. For example, the following setting would define a collection with custom name `Custom_Collection`, and it has a custom field name `Custom_Content` in the database:

@agnes512
Copy link
Contributor Author

@slnode test please

@agnes512
Copy link
Contributor Author

@slnode test please

@agnes512 agnes512 merged commit b0852b0 into master Apr 23, 2020
@delete-merged-branch delete-merged-branch bot deleted the custom-field branch April 23, 2020 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants