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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:20:01+00:00 2026-05-25T12:20:01+00:00

I couldn’t quite find something like this, hence the question. I have a page\blarg

  • 0

I couldn’t quite find something like this, hence the question. I have a page\blarg collection that has an array of Categories. I’d like to be able to pull a list of existing categories and I don’t want to do a Map Reduce so I decided I would just pull all of the categories and then filter them for uniqueness client side. I’d like to only pull arrays that are not empty, though, so I devised the following query:

{ Categories : { $not { $size : 0 } } }

However I don’t know how to replicate it using the driver. $Not takes a BsonValue and $Size just takes an int, I’m not sure how to put a $Size condition in the $Not query. I figured I could use a QueryDocument or something but i’m not sure how to emulate operators via anonymous objects (or at least I haven’t seen any documentation on it).

P.S. I realize I might be able to do an Query.EQ(“Categories”, BsonArray.Create(new List())) or something but I’m interested in the answer for the principle of it at this point, I can think of another scenario where I might want any arrays in which there is more or less than one entry for instance.

  • 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-25T12:20:01+00:00Added an answer on May 25, 2026 at 12:20 pm

    You can express your query in C# as follows:

    var query = Query.Not(“Categories”).Size(0);

    You can verify that it is in fact the same query with:

    var json = query.ToJson();

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

Sidebar

Related Questions

Hi couldn't find it for C#, I am trying something like that for (int
I couldn't find the answer to this in any other question. Suppose that I
Couldn't find an answer to this one. I have a WPF ListView control that
I couldn't find anything similar to this anywhere. I have an array of pointers
I couldn't find this in the documentation. If I have a complex object in
Couldn't find an answer to this question. It must be obvious, but still. I
Couldn't find this directly on the NHAML project page, so i was wondering if
Couldn't seem to find the answer to this question - what is the haml
Couldn't find Submission without an ID This problem has haunted me for last few
Couldn't find anything about this topic. I have a Windows TCP C++ server application

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.