Home > Database > Mysql Tutorial > mongodb 更改数据类型

mongodb 更改数据类型

WBOY
Release: 2016-06-07 16:32:29
Original
1140 people have browsed it

db.bmdMessage.find( { '_id' : { $type : 2 } } ).forEach( function (x) { x._id=ObjectId(x._id); db.bmdMessage.save(x); }); 注意:_id的类型创建了则不允许更改。 参考: 修改MongoDB 字段的类型 官方文档 原文地址:mongodb 更改数据类型, 感谢原作者

db.bmdMessage.find( { '_id' : { $type : 2 } } ).forEach( function (x) { x._id=ObjectId(x._id); db.bmdMessage.save(x); });

注意:_id的类型创建了则不允许更改。
参考:
修改MongoDB 字段的类型
官方文档

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template