Answer the question
In order to leave comments, you need to log in
How to parse an object with nested fields that is returned by MongoEngine (Flask\Backbone\MongoDB bundle)?
Hello!
There is the following problem.
I have object schemas created with MongoEngine:
Users and Items.
In Users there is a ReferenceField items, in which sending to an object from the Items schema is added.
Using Backbone, I need to parse the sent User object, which contains the Items list.
I do it like this:
<% _.each(user.toArray(), function(field, key, list) { %>
<tr>
<td><%- field.get('_id') %></td>
<td><%- field.get('first_name') %></td>
<td><%- field.get('last_name') %></td>
<td><%- field.get('items') %></td>
<% }) %>
</tr>
items: Array[1]0: Object_id: Object$oid: "54638b8089466464ff4d2cf9"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question