Get the App
SLTechnology News&Howtos  ›  Database  › 

Mongodb uses the forEach and js custom functions to modify the 19th character of the specified column

Shulou Source: shulou.com Published: 2022-06-01 13:22:23 10月03日 Update

The following is the test:

Db.csq.insert ({alm:'11110000011111100011110111010110'})

Db.csq.insert ({alm:'01110000011111100011110111010110'})

Db.csq.insert ({alm:'11111111111111111111111111111111'})

Db.csq.find () .forEach (function (e) {

E.alm = e.alm.substr (0jue 19) +'0' + e.alm.substr (20jue 12)

Db.csq.save (e)

});

Tags: Test function character Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux vpn Microsoft Shulou Tech Info Xiaomi