Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add setter and getter for boardsize also for mongodb

  • Loading branch information...
commit 5efc8b489c1dcf627d77898a1972a2fc27701d75 1 parent ac5c342
giacomomacri authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 lib/data/mongodb.js
View
19 lib/data/mongodb.js
@@ -150,6 +150,25 @@ db.prototype = {
{name:room},
{$set:doc}
);
+ },
+ getBoardSize: function(room, callback) {
+ this.rooms.findOne(
+ {name:room},
+ function(err, room) {
+ if(room) {
+ callback(room.size);
+ } else {
+ callback();
+ }
+ }
+ );
+ },
+ setBoardSize: function(room, size) {
+ this.room.findOne({name:room})
+ this.rooms.update(
+ {name:room},
+ {$set:{'size':size}}
+ );
}
};
exports.db = db;
Please sign in to comment.
Something went wrong with that request. Please try again.