• Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register

PHP forum, your PHP coding community

A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.

  • Home Board index php forum :: Database mySQL & php coding
  • Search
Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Disable your ad blocker to continue using our website.

Remove a field from all elements in array in mongodb

Codes here !

Moderators: gesf, Michalio

Post Reply
  • Print view
Advanced search
1 post • Page 1 of 1
hannabone3445
  • Quote

Tue Sep 21, 2021 2:42 pm

I have document in MongoDB(2.4.5)

I want to remove withBase filed from array elements inside casts.crew ..

I tried this

Code: Select all

db.coll.update({_id:235399},{$unset: {  "casts.crew.withBase" : 1 } },false,true)
nothing changed.

And tried this..

Code: Select all

db.coll.update({_id:235399},{$unset: {  "casts.crew" : { $elemMatch: { "withBase": 1 } } } },false,true)
it removed entire crew array from the document.

Can someone please provide me the right query?
Top
Post Reply
  • Print view
1 post • Page 1 of 1

Return to “mySQL & php coding”

Jump to
  • php forum :: php coding
  • ↳   PHP coding => General
  • ↳   PHP coding => Images
  • ↳   PHP coding => Mail
  • PHP
  • ↳   PHP General
  • ↳   PHP Scripts
  • ↳   PHP Installation
  • ↳   PHP Jobs
  • ↳   PEAR and PECL
  • ↳   Your Scripts
  • php forum :: Database
  • ↳   mySQL & php coding
  • ↳   phpMyAdmin
  • ↳   MySQL Installation
  • ↳   Other Database Engines
  • php forum :: PHP and MySQL Security
  • ↳   PHP & MySQL Security
  • System Administration
  • ↳   Server installation and configuration
  • ↳   Server security
  • php forum :: HTML
  • ↳   JavaScript
  • ↳   HTML Basics
  • ↳   CSS
  • php forum :: Bar
  • ↳   Free time
  • ↳   News and Announcements
  • Home Board index
  • All times are UTC-08:00
  • Delete cookies
  • Privacy
  • Terms
 

 

Powered by phpBB™ • Design by PlanetStyles
ASSP Deluxe is a nifty antispam plugin for cPanel that eradicates spam email and the easy-to-install widget comes loaded with additional features and customizations. You can set up criterion for custom spam boxes, receive daily email reports, and tinker with a whole host of other automatable functions, cutting a fraction of your workload.