Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dot notation support or append a new document inside embedded model inside a document #39

Closed
hackerunet opened this issue Apr 30, 2013 · 2 comments

Comments

@hackerunet
Copy link

sorry but I'm not using google app engine, just using django-nonrel with djangotoolbox and mongoengine, and I just saw the site you sent and it has no information about what I'm looking for, can you give me a hand on this?
I have this collection in mongo:

{
"_id" : ObjectId("517f00dbe138234abbf790bb"),
"campaigns" : [
{
"payout" : 0.7,
"landing_page" : [ ],
"rotate_urls" : null,
"_module" : "setup.models",
"_model" : "Campaigns",
"cloaking" : true,
"campaign_name" : "DOS",
"rotate_urls_status" : false,
"affiliate_url" : "http://www.DOS.com/[[subid]]"
}
],
"category_name" : "category2"
}

how can I append a embed document into landing_page using django-nonrel, mongoengine without djangodbindexer support?? I have tried this but I always receive errors:
landingpage = LandingPages(nickname=lpnickname,url=lpurl)
b = Categories.objects.get(id=affnetworkid,campaigns__campaign_name=campaignname)
b.landing_page.append(landingpage)
b.save()

The mongoengine documentation says that doble underscore is supported, but, the fact is that django-nonrel or the mongoengine is trying to execute a join which is not what I'm looking for, how can I use dot notation on this??
how can I just add more documents to the landing_page list type inside campaigns???
thanks
note: I have 8 days trying to achieve this.

@aburgel
Copy link
Member

aburgel commented Apr 30, 2013

i don't know the answer to your question. but you might have more luck on the forum or reading the mongodb-engine issues list, for example here:

django-nonrel/mongodb-engine/issues/115

@aburgel
Copy link
Member

aburgel commented Dec 17, 2013

Hi, sorry for the very delayed response to this. You can solve this problem by using an A() expression or by using raw queries. If you look in django_mongodb_engine/query.py, you'll see how A() expressions work. They are marked as deprecated but we're looking to replace them with something similar, so don't worry about the deprecation.

You can also look at django-nonrel/mongodb-engine#178, which is a pull request that is adding some of these features in a more natural django way.

@aburgel aburgel closed this as completed Dec 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants