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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:00:25+00:00 2026-06-08T00:00:25+00:00

Is it possible to retrieve the subset of fields using Django mongodb nonrel .

  • 0

Is it possible to retrieve the subset of fields using Django mongodb nonrel. I am totally new to python, but have good knowledge in mongo.

My requirement is very straight forward, I wanted to query the collection by its embedded field and return only some specific fields

I could do that in mongodb by

db.Contract.find({'owner.name':'Ram'},{'address':1})

and I tried this in django

Contract.objects.filter(owner__name='Ram')

but it throws an error

raise FieldError(“Join on field %r not permitted. Did you misspell %r
for the lookup type?” % (name, names[pos + 1])) FieldError: Join on
field ‘owner’ not permitted. Did you misspell ‘name’ for the
lookup type?

am totally struck here. I believe i have my models as specified in the documentation.

class SimplePerson(models.Model):
    name = models.CharField(max_length=255)
    user_key = models.CharField(max_length=255)


class Contract(models.Model):
    owner = EmbeddedModelField('SimplePerson')
    title = models.CharField(max_length=120, )

This is really weird. I could’t find any reference in the documentation site about how to query the embedded field & retrieve the subset of fields.

Finally I used raw_query to query the embedded field

Contract.objects.raw_query({'owner.name':'Ram'})

But still not able to figure out how to retrieve the subset of fields. Can someone help me out?

  • 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-08T00:00:27+00:00Added an answer on June 8, 2026 at 12:00 am

    Subobject filters aren’t possible yet so you need to drop down to raw_query (which you already figured out). To retrive a subset of fields, use .values('field1', 'field2', ...).

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

Sidebar

Related Questions

is it possible to retrieve by using connection.getschema() the description item from a sql
Possible Duplicate: How to retrieve user's current city name? using the following methods i
Is it possible to retrieve the information from a sent Push Notification using the
Is it possible to retrieve random rows from table X where flags==0? Using MySql
Is it possible to retrieve an array of request parameters with same key using
Is it possible to retrieve all the static objects which have been created in
Possible Duplicate: Retrieve Windows Experience Rating Using .NET, is there a way to programmatically
Is it possible to retrieve a stored procedure using c#? What i need to
Is it possible to retrieve the contacts without using Activity class? I'm using LWUIT
is it possible to retrieve the username of a google account that i have

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.