Skip to content

Commit

Permalink
Another rename to further prevent name clashes
Browse files Browse the repository at this point in the history
  • Loading branch information
inolasco committed Apr 13, 2014
1 parent a7afca5 commit d5a0629
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/mongodb-backend.js
Expand Up @@ -57,13 +57,13 @@ MongoDBBackend.prototype = {
contract(arguments)
.params('string', 'string', 'function')
.end();
var searchParams = (this.useSingle? {bucketname: bucket, key:key} : {key:key});
var searchParams = (this.useSingle? {_bucketname: bucket, key:key} : {key:key});
var collName = (this.useSingle? aclCollectionName : bucket);

this.db.collection(this.prefix + 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){
collection.findOne(searchParams, {_bucketname: 0},function(err, doc){
if(err) return cb(err);
if(! _.isObject(doc) ) return cb(undefined,[]);
cb(undefined,_.without(_.keys(doc),"key","_id"));
Expand All @@ -79,13 +79,13 @@ MongoDBBackend.prototype = {
.params('string', 'array', 'function')
.end();

var searchParams = (this.useSingle? {bucketname: bucket, key: { $in: keys }} : {key: { $in: keys }});
var searchParams = (this.useSingle? {_bucketname: bucket, key: { $in: keys }} : {key: { $in: keys }});
var collName = (this.useSingle? aclCollectionName : bucket);

this.db.collection(this.prefix + 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){
collection.find(searchParams, {_bucketname: 0}).toArray(function(err,docs){
if(err instanceof Error) return cb(err);
if( ! docs.length ) return cb(undefined, []);
var keyArrays = [];
Expand All @@ -107,7 +107,7 @@ MongoDBBackend.prototype = {

if(key=="key") throw new Error("Key name 'key' is not allowed.");
var self=this;
var updateParams = (self.useSingle? {bucketname: bucket, key:key} : {key:key});
var updateParams = (self.useSingle? {_bucketname: bucket, key:key} : {key:key});
var collName = (self.useSingle? aclCollectionName : bucket);

transaction.push(function(cb){
Expand Down Expand Up @@ -137,7 +137,7 @@ MongoDBBackend.prototype = {
.end();
keys = makeArray(keys);
var self= this;
var updateParams = (self.useSingle? {bucketname: bucket, key:{$in:keys}} : {key:{$in:keys}});
var updateParams = (self.useSingle? {_bucketname: bucket, key:{$in:keys}} : {key:{$in:keys}});
var collName = (self.useSingle? aclCollectionName : bucket);

transaction.push(function(cb){
Expand All @@ -160,7 +160,7 @@ MongoDBBackend.prototype = {
.end();

var self=this;
var updateParams = (self.useSingle? {bucketname: bucket, key:key} : {key:key});
var updateParams = (self.useSingle? {_bucketname: bucket, key:key} : {key:key});
var collName = (self.useSingle? aclCollectionName : bucket);

values = makeArray(values);
Expand Down

0 comments on commit d5a0629

Please sign in to comment.