发布于 2015-09-14 15:06:19 | 154 次阅读 | 评论: 0 | 来源: 网络整理

$unset

The $unset operator deletes a particular field. Consider the following example:

db.collection.update( { field: value1 }, { $unset: { field1: "" } } );

The above example deletes field1 in collection from documents where field has a value of value1. The value of the field in the $unset statement (i.e. "" above) does not impact the operation.

If documents match the initial query (e.g. { field: value1 } above) but do not have the field specified in the $unset operation (e.g. field1), then the statement has no effect on the document.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务