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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:30:49+00:00 2026-05-18T07:30:49+00:00

Gurus – I’m stuck in a situation that I can’t figure out how I

  • 0

Gurus – I’m stuck in a situation that I can’t figure out how I can query from the following collection “users“, it has 2 embedded documents “signup” and “activity“:

{
    "appid": 2,
    "userid": 404915,
    "signup": {
        "dt": "2010-12-28",
        "platform": 2 
    },
    "activity": {
        {
            "dt": "2010-12-28",
            "platform": 3,
            "login_count": 8,
            "game_completed": 13 
        },
        {
            "dt": "2010-12-30",
            "platform": 3,
            "login_count": 8,
            "game_completed": 13 
        } ,
        {
            "dt": "2010-12-31",
            "platform": 3,
            "login_count": 8,
            "game_completed": 13 
        } 
    }
},{"appid":2,"userid":404915...}

I need to query:

unique logins of users who signed up between Date and Date+7 and logged in within Date

Then:

Unique logins of users who signed up between Date and Date+7, and logged in between Date+7 and Date+14

PLEASE PLEASE Guide me how I can achieve this any example/sample? based on this will be really helpful 🙂

Thanks a lot!

  • 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-18T07:30:50+00:00Added an answer on May 18, 2026 at 7:30 am

    Here is how you get the result for your first query:

    var start = new Date(2010, 11, 25);
    var end = new Date(2010, 12, 1);
    
    db.users.distinct("userid", {"signup.dt" : {$gte: start, $lte: end},
          "activity" : {"$elemMatch" : { dt: {$gte: start, $lte: end}}}});
    

    The second is like it with adding 7 days to the start and end date to the dates after activity.

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

Sidebar

Related Questions

Gurus - I'm stuck in a situation that I can't figure out how I
http://jsfiddle.net/YHJrV/2/ Can any CSS gurus figure out why webkit has issues toggling between display:table-cell
For you database design/performance gurus out there. If you have a database that is
Ok SQL and Oracle gurus I have a somewhat complicated query that I'm trying
Are there any Emacs gurus out there who can tell me how to bind
Are there any Nginx / FastCGI gurus out there who can help me? I'm
Just want to ask the gurus out there about this. I know that CSS
To you gurus out there, is there any hidden gem in PHP that could
Gurus! Can anybody answer: where defined parameter numPartitions in Partitioner class(value of this paramen)?
LINQ gurus, I am looking for help to write a query... I have a

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.