improve spacing

This commit is contained in:
Alice Harris
2015-02-07 14:00:21 +10:00
parent ef8b783f2b
commit 734227c472

View File

@@ -42,7 +42,9 @@
var uuid='30fb2640-7121-4968-ace5-f385e60ea6c5'; var uuid='30fb2640-7121-4968-ace5-f385e60ea6c5';
db.users.aggregate([ db.users.aggregate([
{$match: {'_id': uuid} }, {$match: {
'_id': uuid
}},
{$project: { {$project: {
'_id':0, 'todos':1 '_id':0, 'todos':1
}}, }},
@@ -51,17 +53,17 @@ db.users.aggregate([
_id: { taskid: '$todos.id' }, _id: { taskid: '$todos.id' },
count: { $sum: 1 } count: { $sum: 1 }
}}, }},
{ $match: { {$match: {
count: { $gt: 1 } count: { $gt: 1 }
}}, }},
{ $project: { {$project: {
'_id.taskid':1, '_id.taskid':1,
}}, }},
{$group: { {$group: {
_id: { taskid: '$todos.id' }, _id: { taskid: '$todos.id' },
troublesomeIds: { $addToSet: "$_id.taskid" }, troublesomeIds: { $addToSet: "$_id.taskid" },
}}, }},
{ $project: { {$project: {
'_id':0, '_id':0,
troublesomeIds:1, troublesomeIds:1,
}}, }},
@@ -73,8 +75,8 @@ db.users.aggregate([
db.users.update({ db.users.update({
'_id': uuid, '_id': uuid,
'todos': { $elemMatch: { id: taskid } } 'todos': { $elemMatch: { id: taskid } }
}, },{
{ $set: { "todos.$.id" : 'de666' } $set: { "todos.$.id" : 'de666' }
}); });
}); });
} }
@@ -82,8 +84,7 @@ db.users.aggregate([
db.users.update( db.users.update(
{'_id': uuid}, {'_id': uuid},
{ $pull: { todos: { id: 'de666' } } }, {$pull: { todos: { id: 'de666' } } },
{ multi: false } {multi: false }
); );