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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:23:34+00:00 2026-06-07T13:23:34+00:00

what i want, is to only return the _id and data in meta (not

  • 0

what i want, is to only return the _id and data in meta (not my field, but since mongoose has this prime example): mongoose embedd documents doc

so, i’m not looking for any _id in particular, i’m looking for records with meta.votes.length > 0 or meta.fans.length > 0. currently i do:

Model.find({}, ['_id','meta'], function (err, data) {
callback(null, data);
});

i get records with no /data/. i guess an alternative to not finding these sets would be a way to filter them out?

EDIT: i have temporarily resolved my issue with:

use : { type: Boolean, default: 1 },

though this might be a feature (showing and hiding results – old data for instance), i don’t consider this a /solution/.

  • 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-07T13:23:37+00:00Added an answer on June 7, 2026 at 1:23 pm

    Well meta.votes and meta.fans are both just Number objects so I don’t think you want meta.fans.length just access them directly like an int.

    This query should retrieve just the _id and meta information for votes > 0

    Model.find({ "meta.votes" : { $gt : 0 } }, ['_id','meta']).exec(function(err, data) {
       callback(null, data);
    });
    

    And this query should retrieve just the _id and meta information for fans > 0

    Model.find({ "meta.fans" : { $gt : 0 } }, ['_id','meta']).exec(function(err, data) {
       callback(null, data);
    });
    

    And you could pull both queries together like this:

    Model.find({ $or : [ { "meta.votes" : { $gt : 0 } },
                         { "meta.fans" : { $gt : 0 } } ] }, ['_id','meta']).exec(function(err, data) {
       callback(null, data);
    });
    

    You should be seeing returns like: { _id: 5001b3ce7cf4b534a3000002, meta: { votes: 1, fans: 1 } }

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

Sidebar

Related Questions

When paging data, I want to not only return 10 results, but I also
I want to implement all my own rotation animations but if I only return
I want to run a basic query, but return only the first ten rows
I want to merge this queries into only one, to return 2 values (scount_atp
I want regExp to test for two 'Hello'-s and return true but it only
document.onkeydown.toString() returns onkeydown function but I only want to get this function's name. Is
I used HTTPService for reading xml, but I want only a particular xml field
How can I return the key?, mean if I want to allow only integer
I create a VBO in a function and I only want to return the
I want my ajax call to only return the values from my array in

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.