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 6344507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:39:10+00:00 2026-05-24T20:39:10+00:00

I ran the following query on a collection in my mongodb database. db.coll.find({field_name:{$exists:true}}).count() and

  • 0

I ran the following query on a collection in my mongodb database.

db.coll.find({field_name:{$exists:true}}).count() and it returned 2437185. The total records reported by db.coll.find({}).count() is 2437228 .

Now when i run the query db.coll.find({field_name:{$exists:false}}).count() , instead of returning 43 it returned 0.

I have the following two questions :

  1. Does the above scenario mean that the data in my collection has become corrupt ?.

  2. I had posted a question earlier about this at ( Updating records in MongoDB through pymongo leads to deletion of most of them). The person who replied said that updating data in mongo db could blank out the data but not delete it. What does that mean ?.

Thank You

  • 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-05-24T20:39:11+00:00Added an answer on May 24, 2026 at 8:39 pm

    I believe you’re running into the issue reported at SERVER-1587. What version of MongoDB are you using? If it is less than 1.9.0, you can use the following as a work-around:

    db.coll.find({field_name: {$not: {$exists: true}}}).count()
    

    As for the other question, “blanking out” in this case means that an update can change the value of or unset any or all fields in a document, but can’t remove the document itself. The only way to remove a document is with remove()

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

Sidebar

Related Questions

I have the following query that I ran on my database to remove some
In our production database, we ran the following pseudo-code SQL batch query running every
I ran into an interesting error with the following LiNQ query using LiNQPad and
I have the following ActiveRecord query. It ran fine when the number of messages
I ran the following query in MySQL command line and the tables were created.
I started Solr and ran the following query: curl http://localhost:8983/solr/dataimport?command=full-import&commit=true I then checked the
I ran the following simple query that looks like the example below: (Briefly; one
I ran the following query, which should have had a where clause but I
I apologize for the vagueness of the question, but I ran the following query
I ran the following code in PHPAdmin's terminal: SELECT COUNT( * ) FROM User

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.