MongoDB $unset

MongoDB $unset

MongoDB 02-03-2023 Saheb Sutradhar

MongoDB $unset

 

How to remove property from mongoDB document ?

By using $unset we can remove property from mongo document  

{

name:"codelearningpoint",

text:'xyz'

 

if I want to remove the test property from the document , using $unset we can do that.

$unset can be use only with update functions updateOne() , updateMany()

db.collection.updateOne( {name:"codelearningpoing"} ,{$unset:{text:''}} )

 

Related Posts

Card image cap

MongoDB Basic and CRUD Operations

MongoDB 02-09-2022 Saheb Sutradhar

MongoDB Basic and CRUD Operations ...

Card image cap

MongoDB Read Array Document

MongoDB 05-02-2023 Saheb Sutradhar

MongoDB Read Array Document ...

Card image cap

MongoDB read operation findOne() and find()

MongoDB 05-02-2023 Saheb Sutradhar

MongoDB read operation findOne() and find() ...

Card image cap

MongoDB upsert

MongoDB 02-03-2023 Saheb Sutradhar

MongoDB upsert ...

Card image cap

MongoDB $rename

MongoDB 02-03-2023 Saheb Sutradhar

MongoDB $rename ...

Card image cap

MongoDB array update operation

MongoDB 13-03-2023 Saheb Sutradhar

MongoDB array update operation ...