Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7799479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:19:22+00:00 2026-06-02T00:19:22+00:00

Using Node.js, mongoDB, mongoose: I have a db collection whos records have field of

  • 0

Using Node.js, mongoDB, mongoose:

I have a db collection whos records have field of arrays of strings.

I need to remove items in the arrays of all records that match a passed string.

This involves finding all records which have an array containing match, splicing item from array and saving records back to db.

I’m struggling to work out how to do this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:19:24+00:00Added an answer on June 2, 2026 at 12:19 am

    You should be able to do this with a $pull or a $pullAll (as described here: http://www.mongodb.org/display/DOCS/Updating#Updating-%24pull). E.g., in the shell:

    > db.coll.update({}, {$pull : {arrField : passedString}}, false, true);
    

    This updates all documents by pulling the passedString from the arrField array, if it exists. (false for no upsert, true to update multiple docs.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Mongoose, MongoDB, and Node.js. I would like to define a schema where
I have built my application using node.js, mongodb, redis, express, socket.io and planning to
I am using node.js with express. I read out data from MongoDB with Mongoose
I'm running node.js on OSX and have just installed mongodb using command npm install
I am new to Node, and I'm using Mongoose as a driver for MongoDB.
Using Jade + Express + Node.js + Mongoose + MongoDB for my app, but
I'm using the Mongoose Library for accessing MongoDB with node.js Is there a way
I have just installed MongoDB in my machine (Windows 7) and installed node-mongodb-native using
Using node.js / expressjs / mongoose / mongoose-auth / everyauth. All versions are up
I have a Node.js app using Express that stores data in a mongoDB (locally).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.