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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:25:40+00:00 2026-06-06T00:25:40+00:00

I have read the documentation and searched all over but I can’t find how

  • 0

I have read the documentation and searched all over but I can’t find how to do it.
If I have a document inside a collection and the document is an empty array I can remove it like this:

db.data.remove(array('document'=>array()))

or like this:

db.data.remove(array('document'=>[]))

But if the array is not empty it doesn’t work, so I tried like this:

db.data.remove(array('document'=>array('$type'=>4)))

Am I doing it wrong? Is there any way to do this?
Removing the document on another criteria isn’t useful for me.

  • 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-06T00:25:42+00:00Added an answer on June 6, 2026 at 12:25 am

    Edit:
    Finally I found out what your problem is.

    // test document
    { "_id" : ObjectId("4fe1af4dd404b1863ff20aac"), "document" : [ 1 ] }
    

    The $type operator looks inside the array, not the array itself so the following find returns nothing:

    db.test.find({document : { $type : 4  } })
    

    Now in my testcase the document contains a double, the following find returns the document:

    db.test.find({document : { $type : 1  } })
    { "_id" : ObjectId("4fe1af4dd404b1863ff20aac"), "document" : [ 1 ] }
    

    Please see also the bug report about this topic:
    https://jira.mongodb.org/browse/SERVER-1475

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

Sidebar

Related Questions

I have looked, searched, and read documentation and can't really find anything about this.
I have read the FactoryGirl documentation, but I can't seem to figure this out.
I have read the documentation ( http://dev.mysql.com/doc/refman/5.1/en/partitioning.html ), but I would like, in your
I have read all the documentation I found on how to integrate Unity3D projects
I have read the documentation of each function on jQuery official website , but
I have searched the web and read through the Boost documentation about shared_ptr .
I have read the documentation for the CI Caching but still don't understand much
I have read the documentation for this element but still fail to understand what
I have read from documentation how can I set minheight and minwidth of modal
I have read the documentation at http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html , but don't understand when the around_*

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.