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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:43:48+00:00 2026-06-13T08:43:48+00:00

I am querying a Mongo DB in Scala and looping through the returned elements,

  • 0

I am querying a Mongo DB in Scala and looping through the returned elements, that look like this:

{ "_id" : "123:1350918540586068000:v" , 
    "i" : { 
        "vendorStyle" : "coolStyle" , 
        "createdAt" : 1350918540580 , 
        "productId" : "product123" , 
        "skuId" : "123"
    }
}

My question is: how do I retrieve the value from skuId? I know you can use the notation parent.child in the ‘find’ method in Mongo, but that doesn’t work when reading from the resulting DBObject

This is the code:

val elems = SkuStorage.collection.find(MongoDBObject("i.productId" -> productId))
elems.toSeq.map { element=>
    readSkuById(element.get("i.skuId")) //breaks! 
}

Do I need to go get(“i”) then parse the string into a JSON? Is there any better way of handling this?

  • 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-13T08:43:49+00:00Added an answer on June 13, 2026 at 8:43 am

    You could try

    element.expand[String]("i.skuId")
    

    it returns Option[String]

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

Sidebar

Related Questions

Querying wordpress posts according to their tags can look like this (if I pieced
i'm querying a database like this: SELECT * from Log WHERE cookieId IN (select
I have an odd issue querying mongo.. I insert a bunch of records like
Just started mongo and started having issue with querying already. i have a collection
Querying a Nested Set Model table , here's the SQL... how can this be
I'm querying the database for a single record that matches the id passed in
I'm querying an MFC implemented COM object that is implemented as follows: class CA
Basically I'm querying a table like the following keywordId | keyword 1 abc 1
While querying RavenDB I am noticing that it does not get the expected results
Right now I have a Java application running WMI querying event logs, this is

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.