Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

324
Views
How to query nested properties using MongoTalk on Pharo?

I’m trying to create a Mongo query on a nested attribute of the doc, in the javascript Mongo shell it would be:

db.users.find({"services.facebook.email": "some@example.com"})

How I could execute that query using a query of MongoTalk?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You can query using a “regular” Mongo Query (a.k.a. JSON/Dictionary query) or using MongoQuery using Block Syntax:

mongo := Mongo default.
db := mongo databaseNamed: 'test'.
users := db getCollection: 'users'.

user1 := { 'services' -> {
    'facebook' -> { 'email' -> 'some@example.com' } asDictionary
    }  asDictionary
} asDictionary.

users add: user1.

"Query using dictionary"
users select: {'services.facebook.email' -> 'some@example.com'} asDictionary.

"Query using MongoQuery"
users select: [ :each | (each at: 'services.facebook.email') = 'some@example.com' ].
over 4 years ago · Santiago Trujillo Report

0

In Voyage, you have to do something like this:

Users selectMany: [ :each | (each at: 'services.facebook.email') = 'some@example.com' ]

Since this is MongoQueries, if you are using directly MongoTalk (without Voyage), you can execute the same query in your MongoCollection.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!