Ember data and mongodb state?

女生的网名这么多〃 提交于 2019-12-24 06:38:12

问题


According to http://emberjs.com/api/data/classes/DS.EmbeddedRecordsMixin.html

Records without an id property are not considered embedded records, model instances must have an id property to be used with Ember Data.

If thats so how would i use a model like:

 {
    "_id": "545b54f20dbd7015f015359a", 
    "comments": [
        {
            "msg": "what is this jelly", 
            "time": "1415271666", 
            "user": {
                "id": "53fefc9ee4b07d3fe92fc077", 
                "username": "kfir124"
            }
        }
    ], 
    "files": [
        {
            "key": "1415271653.39af9c9fb8cc8b49dcaac5eec72614ce85.jpg", 
            "order": 0
        }
    ], 
    "time": "1415271666", 
    "uploader": {
        "id": "53fefc9ee4b07d3fe92fc077", 
        "username": "kfir124"
    }
}  

So uploader may be an embedded record but what about files and comments? they are both arrays of objects which do not live outside of the main model's namespace therefore they have no IDs

来源:https://stackoverflow.com/questions/26994474/ember-data-and-mongodb-state

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!