Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
leshy committed May 11, 2012
1 parent 9973524 commit 96b02ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
18 changes: 10 additions & 8 deletions index.js
Expand Up @@ -107,6 +107,7 @@ var DbCollection = Collection.extend4000({
},

update: function(select,data,callback) {
console.log('updating', this.get('name'), select,data)
this.get('collection').update(select, { '$set' : data }, function(err,data) {
console.log("RES",err,data)
callback(err,data)
Expand Down Expand Up @@ -143,7 +144,6 @@ var CollectionExposer = MsgNode.extend4000({
},

initialize: function() {
console.log("ALLOW",{body: {collection: this.get('model').prototype.defaults.name}})
this.lobby.Allow({body: {collection: this.get('model').prototype.defaults.name}})
this.subscribe({body: {filter: true}}, this.filterMsg.bind(this))
this.subscribe({body: {create: true}}, this.createMsg.bind(this))
Expand All @@ -152,7 +152,7 @@ var CollectionExposer = MsgNode.extend4000({
},

removeMsg: function(msg,callback) {
this.remove({ "_id": BSON.ObjectID(msg.body.remove) })
this.remove(msg.body.o)
callback()
},

Expand Down Expand Up @@ -202,11 +202,15 @@ var CollectionExposer = MsgNode.extend4000({
if (!msg.body.select) {
msg.body.select = { _id: msg.body.update.id }
}
if (msg.body.select.id) { msg.body.select._id = msg.body.select.id; delete msg.body.select['id'] }

msg.body.select._id = new BSON.ObjectID(msg.body.select._id)
if (msg.body.select.id) {
msg.body.select._id = msg.body.select.id; delete msg.body.select['id']
}

if (msg.body.select._id) {
msg.body.select._id = new BSON.ObjectID(msg.body.select._id)
}

console.log('db.task.update',msg.body.select, msg.body.update)
console.log('db.update',msg.body.select, msg.body.update)
this.update(msg.body.select,msg.body.update, function(err,data) {
})

Expand All @@ -229,8 +233,6 @@ var CollectionExposer = MsgNode.extend4000({
callback(err,new Msg({created:String(data[0]._id)}))
})
}


})


Expand Down
4 changes: 2 additions & 2 deletions shared.js
Expand Up @@ -271,7 +271,7 @@ var MsgNode = Backbone.Model.extend4000(
},

MsgIn: decorate(MakeObjReceiver(Msg),function(message,callback) {
// console.log(">>>", this.get('name'), message);
console.log(">>>", this.get('name'), message);

if (!message) { return }
var self = this
Expand Down Expand Up @@ -362,7 +362,7 @@ var RemoteModel = Backbone.Model.extend4000({
},

verifypermissions: function(origin,data) {
console.log("green lighting", origin)
//console.log("green lighting", origin)
return false
},

Expand Down

0 comments on commit 96b02ce

Please sign in to comment.