Last active
April 28, 2017 07:08
-
-
Save asyndrige/4c6e2fbbab99a4e5d06b245afca132a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rights_id = db.getCollection('right').find({}, {_id:1}).map(function(item){ return item._id; }) | |
db.getCollection('virtual_reading_room_group').update( | |
{}, | |
{$push: {rights: {$each: rights_id}}} | |
); | |
////////////////////////// | |
db.getCollection('right').remove({"is_template": true}); | |
var rights_id = db.getCollection('right').find({}, {_id:1, doc_type:1}).map(function(item){ | |
return item._id; | |
}); | |
var delete_rights_id = db.getCollection('right').find({"doc_type": "close"}, {_id:1, doc_type:1}).map(function(item){ | |
return item._id; | |
}); | |
db.getCollection('virtual_reading_room_group').update( | |
{}, | |
{$pull: {rights: {$in: delete_rights_id}}} | |
); | |
db.getCollection('right').remove({_id: {$in: delete_rights_id}}); | |
// db.getCollection('virtual_reading_room_group').update( | |
// {}, | |
// {$push: {rights: {$each: rights_id}}} | |
// ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment