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

Bugfix/mongodb unsupported char #113

Merged
merged 10 commits into from
Mar 20, 2017
Prev Previous commit
Next Next commit
Rename method.
  • Loading branch information
Jonathan Massot committed May 20, 2015
commit 98f050affdcfd22d0d9dc91f5fc9ada5f87fce97
12 changes: 6 additions & 6 deletions lib/mongodb-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ MongoDBBackend.prototype = {
var searchParams = (this.useSingle? {_bucketname: bucket, key:key} : {key:key});
var collName = (this.useSingle? aclCollectionName : bucket);

this.db.collection(this.prefix + removeMongoDBUnsportedChar(collName),function(err,collection){
this.db.collection(this.prefix + removeUnsupportedChar(collName),function(err,collection){
if(err instanceof Error) return cb(err);
// Excluding bucket field from search result
collection.findOne(searchParams, {_bucketname: 0},function(err, doc){
Expand All @@ -84,7 +84,7 @@ MongoDBBackend.prototype = {
var searchParams = (this.useSingle? {_bucketname: bucket, key: { $in: keys }} : {key: { $in: keys }});
var collName = (this.useSingle? aclCollectionName : bucket);

this.db.collection(this.prefix + removeMongoDBUnsportedChar(collName),function(err,collection){
this.db.collection(this.prefix + removeUnsupportedChar(collName),function(err,collection){
if(err instanceof Error) return cb(err);
// Excluding bucket field from search result
collection.find(searchParams, {_bucketname: 0}).toArray(function(err,docs){
Expand Down Expand Up @@ -116,7 +116,7 @@ MongoDBBackend.prototype = {
var collName = (self.useSingle? aclCollectionName : bucket);
transaction.push(function(cb){
values = makeArray(values);
self.db.collection(self.prefix + removeMongoDBUnsportedChar(collName), function(err,collection){
self.db.collection(self.prefix + removeUnsupportedChar(collName), function(err,collection){
if(err instanceof Error) return cb(err);

// build doc from array values
Expand Down Expand Up @@ -145,7 +145,7 @@ MongoDBBackend.prototype = {
var collName = (self.useSingle? aclCollectionName : bucket);

transaction.push(function(cb){
self.db.collection(self.prefix + removeMongoDBUnsportedChar(collName),function(err,collection){
self.db.collection(self.prefix + removeUnsupportedChar(collName),function(err,collection){
if(err instanceof Error) return cb(err);
collection.remove(updateParams,{safe:true},function(err){
if(err instanceof Error) return cb(err);
Expand All @@ -169,7 +169,7 @@ MongoDBBackend.prototype = {

values = makeArray(values);
transaction.push(function(cb){
self.db.collection(self.prefix + removeMongoDBUnsportedChar(collName),function(err,collection){
self.db.collection(self.prefix + removeUnsupportedChar(collName),function(err,collection){
if(err instanceof Error) return cb(err);

// build doc from array values
Expand All @@ -186,7 +186,7 @@ MongoDBBackend.prototype = {
}
}

function removeMongoDBUnsportedChar(text) {
function removeUnsupportedChar(text) {
if (typeof text == 'string' || text instanceof String) {
text = decodeURIComponent(text);
text = text.replace(/\//g, '');
Expand Down