You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to MongoEngine Developers
I have two related ListField questions;
1. What is the best way to append additional EmbeddedDocumentFields to
a ListField in an already saved Document?
2. How can I count the number of items in a ListField?
Thanks for any help
Em
Ross Lawley
unread,
Feb 28, 2012, 12:17:42 PM2/28/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongoen...@googlegroups.com
Hi,
1) The best way is just to use the push method eg:
2) Counting - either return the document and do a len or denormalise and add a counter.
Ross
Em Iscreant
unread,
Feb 28, 2012, 12:38:19 PM2/28/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongoen...@googlegroups.com
Ross,
Sweet! Thanks so much the prompt and helpful reply. Both solutions worked.
Are these issues in the documentation? Perhaps I was using the wrong search approach, but I could not find the answers anywhere.
Thanks again
Em
Ross Lawley
unread,
Feb 29, 2012, 4:11:42 AM2/29/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongoen...@googlegroups.com
Em,
I'll double check - the push operator is native to mongoDB though :) The second is its just a list and as theres no way to compute that in the query language, so you have to use raw python, denormalising is just a trick you might want to use if your doing pagination and wanting to slice the ListField so not all of it is returned.