您好,欢迎来到二三娱乐。
搜索
您的当前位置:首页mongodb数据之间的转换

mongodb数据之间的转换

来源:二三娱乐

1、int转换为string类型

db.collectionName.find().forEach(function(x) {
x.FieldName = x.FieldName.toString();
db.collectionName.save(x);
});

2、string转换为Date类型

db.collectionName.find().forEach(function(x) {
x.FieldName = new ISODate(x.FieldName );
db.collectionName.save(x);
});

 3、string转换为int类型

//string转为int类型
db.collections.find().forEach( function (x) {
  x.ise= NumberInt (x.ise);
  db.collections.save(x);
});

Copyright © 2019- yule263.com 版权所有 湘ICP备2023023988号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务