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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reworking "Bugfix/mongodb unsupported char" (pull request #113) #228

Merged
merged 17 commits into from
Mar 20, 2017
Merged

Reworking "Bugfix/mongodb unsupported char" (pull request #113) #228

merged 17 commits into from
Mar 20, 2017

Conversation

leodutra
Copy link
Contributor

@leodutra leodutra commented Feb 13, 2017

Removes unsupported chars from collection names.
Introduces a flag (useRawColletionNames) for easy fallback, since it is a breaking change.

Enhances Massot's sanitization by replacing slashes and spaces by underlines, easing reading.
Merges the old pull request code with the latest changes from the master branch of this repository, without conflicts.

Please, review.

@manast
Copy link
Member

manast commented Feb 14, 2017

Thanks for the patch. I will review it as soon as I can.

@manast
Copy link
Member

manast commented Feb 14, 2017

I am wondering, is not that when using invalid collection characters, mongodb will complain? if so, in which case would you like to use raw collection names?

@leodutra
Copy link
Contributor Author

leodutra commented Feb 14, 2017 via email

@leodutra
Copy link
Contributor Author

leodutra commented Mar 13, 2017

Reminding.

If this becomes old, conflicts can happen with newer code changes and it will have to be reworked.

@@ -199,11 +200,10 @@ MongoDBBackend.prototype = {
}
}

function removeUnsupportedChar(text) {
if (typeof text == 'string' || text instanceof String) {
function removeUnsupportedChar(text, useRawColletionNames) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this method should be part of the prototype, by doing that you will not need to pass useRawCollectionNames in every call.

Copy link
Contributor Author

@leodutra leodutra Mar 14, 2017

Choose a reason for hiding this comment

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

It will be exposed, is this a problem? Use '_' (internal) prefix?

@@ -12,10 +12,11 @@ var _ = require('lodash');
// If prefix is specified, it will be prepended to this name, like acl_resources
var aclCollectionName = 'resources';

function MongoDBBackend(db, prefix, useSingle){
function MongoDBBackend(db, prefix, useSingle, useRawColletionNames){
this.db = db;
Copy link
Member

Choose a reason for hiding this comment

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

Note the typo: it is useRawCollectionNames, missing C on the code.

"useRawColletionNames" -> "useRawCollectionNames"
Copy link
Contributor Author

@leodutra leodutra left a comment

Choose a reason for hiding this comment

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

Typo fixed.
Gonna move the method.

@leodutra
Copy link
Contributor Author

Review changes done. Test needed. I don't have a test environment on my current machine.
Please, test before pulling or wait for my test.

@rxjs-space
Copy link

@manast , Hi, the npm package is not updated to include this pr. Still having trouble as #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.

4 participants