hasMany relation and large data sets

Hi, i do not understand one monent:

HasMany relation required field with all ids of related models, but if these related models is very much, how i store it in one field?

For example my data containts field “forum_ids”, how do i make HasMany relation without this field? Related models has field “forum_category_id”, or its possible only with separated qurey?

Thanks and sorry for my english :slight_smile:

{"ForumCategorys": [
    {
        "_id": {
            "$id": "52b8168a01c25ee41b000029"
        },
        "name": "category_name",
        "title": "Category 1",
        "description": "Description for category",
        "forum_ids": [
            {
                "$id": "52b8168a01c25ee41b00002a"
            },
            {
                "$id": "52b8168a01c25ee41b00002b"
            },
        ]
    }
], "Forums": [
    {
        "_id": {
            "$id": "52b8168a01c25ee41b00002a"
        },
        "name": "First",
        "title": "This is first forum!",
        "description": "Description for First",
        "topics": null,
        "posts": null,
        "last_message_id": null,
        "forum_category_id": {
            "$id": "52b8168a01c25ee41b000029"
        }
    },
    {
        "_id": {
            "$id": "52b8168a01c25ee41b00002b"
        },
        "name": "Last",
        "title": "This is last forum",
        "description": "Description for Last",
        "topics": null,
        "posts": null,
        "last_message_id": null,
        "forum_category_id": {
            "$id": "52b8168a01c25ee41b000029"
        }
    }
]}

Hmm, I think I understand, but one only question, meybe there method for using has many without “forum_ids” field?

Hi,

You are right. I use a simple: someField: hasMany('relationalModel').

Without the ‘__ids’ field addition. But if you use the _ids part, you can look in the updated guide about relationships: Ember.js RELATIONSHIPS

Hi, what should I see in the manual? I use custom keyForRelationship

App.ApplicationSerializer = DS.RESTSerializer.extend({
    primaryKey: '_id',
    keyForRelationship: function(rel, kind) {
        var underscored;
        if (kind === 'belongsTo') {
            underscored = rel.underscore();
            return underscored + "_id";
        } else {
            var singular = rel.singularize();
            underscored = singular.underscore();
            return underscored + "_ids";
        }
    }
});

but the field’s name does not change the essence of the problem