0 votes
1 view
in Web Technology by (40.4k points)

name: 'book', 

tags: { 

words: ['abc','123'], 

lat: 33, long: 22 

}

Suppose this is a document. How do I remove "words" completely from all the documents in this collection? I want all documents to be without "words":

name: 'book', 

tags: { 

lat: 33, 

long: 22 

}

1 Answer

0 votes
by (92.9k points)

You can use the below-mentioned code to remove a field completely from a MongoDB document:-

db.example.update({}, {$unset: {words:1}}, false, true);

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Sep 13 in SQL by Sammy (40.4k points)
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...