Skip to content

Instantly share code, notes, and snippets.

@atlanmatrix
Created May 6, 2019 10:06
Show Gist options
  • Save atlanmatrix/6ca56fca51b583d4423a410dcd8e7381 to your computer and use it in GitHub Desktop.
Save atlanmatrix/6ca56fca51b583d4423a410dcd8e7381 to your computer and use it in GitHub Desktop.
db.getCollection('page').find({site:"cotaiwaterjet", lan:"en"}).forEach(function(doc){
delete doc["_id"]
if (doc.page_name) {
doc['lan'] = 'ko'
page_name_list = doc.page_name.split('')
page_name_list[0] = 'k'
page_name_list[1] = 'o'
doc['page_name'] = page_name_list.join('')
db.page.insertOne(doc)
doc['lan'] = 'jp'
page_name_list = doc.page_name.split('')
page_name_list[0] = 'j'
page_name_list[1] = 'p'
doc['page_name'] = page_name_list.join('')
db.page.insertOne(doc)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment