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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:05:12+00:00 2026-05-29T08:05:12+00:00

I have such structure of document: { _id : 4e76fd1e927e1c9127d1d2e8, name : ***, embedPhoneList

  • 0

I have such structure of document:

{  
    "_id" : "4e76fd1e927e1c9127d1d2e8",  
    "name" : "***",  
    "embedPhoneList" : [  
        {  
            "type" : "家庭",  
            "number" : "00000000000"  
        },  
        {  
            "type" : "手机",  
            "number" : "00000000000"  
        }  
    ],  
    "embedAddrList" : [  
        {  
            "type" : "家庭",  
            "addr" : "山东省诸城市***"  
        },  
        {  
            "type" : "工作",  
            "addr" : "深圳市南山区***"  
        }  
    ],  
    "embedEmailList" : [  
        {  
            "email" : "********@gmail.com"  
        },  
        {  
            "email" : "********@gmail.com"  
        },  
        {  
            "email" : "********@gmail.com"  
        },  
        {  
            "email" : "********@gmail.com"  
        }  
    ]  
} 

What I wan’t to do is find the document by it’s sub document,such as email in embedEmailList field.
Or if I have structure like this

{  
    "_id" : "4e76fd1e927e1c9127d1d2e8",  
    "name" : "***",   
    "embedEmailList" : [  
        "123@gmail.com" ,  
        "********@gmail.com" ,  
        ]  
} 

the embedEmailList is array,how to find if there is 123@gmail.com?

Thanks.

  • 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-29T08:05:14+00:00Added an answer on May 29, 2026 at 8:05 am

    To search for a specific value in an array, mongodb supports this syntax:

    db.your_collection.find({embedEmailList : "foo@bar.com"});
    

    See here for more information.

    To search for a value in an embedded object, it supports this syntax:

    db.your_collection.find({"embedEmailList.email" : "foo@bar.com"});
    

    See here for more information.

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

Sidebar

Related Questions

I have such structure in my jsp: <h:commandLink action=#{docbean.save}> <a4j:actionParam name=somename value=bill_all assignTo=#{billdoc.billType}/> <a4j:actionParam
I have such a C++ structure: typedef struct _FILE_OP_BLOCK { unsigned short fid; //
I have a server application with such structure: There is one object, call him
Suppose I have code that maintains a parent/children structure. In such a structure I
I have a database structure that has a Person table which contains fields such
Suppose I have a structure in C or C++, such as: struct ConfigurableElement {
I have a few classes, such as those that outline database table structure or
I have something that looks like the following document structure: public class Document {
I have an xml sitemap structured like a document tree, such that it looks
I have such table structure(I can replace with Div if it is possible to

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.