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

report a bug about mulit-keys #150

Closed
huangyingjie opened this issue May 8, 2013 · 3 comments
Closed

report a bug about mulit-keys #150

huangyingjie opened this issue May 8, 2013 · 3 comments

Comments

@huangyingjie
Copy link

Hi,
I have upgrade orm to 2.0.11, the error log in #135 disappeared, however, when I use the find method, it returns a list of results that each one is all the same. It repeats one and only one result many times.

         webperformance.find(query, 10, function (err, page) {
         });

I had met this once when I added the column id but do not set it to primary key and default value is null;
Here is my Model;

    db.define("webperformance", {
        datekey: Number,
        domain: String,
        url: String,
        ......
    }, {
        cache: 12 * 3600,
        keys : [ "datekey", "domain", "url" ]
    });

And here is my table;

+--------------------------+--------------+------+-----+---------+-------+
| Field                    | Type         | Null | Key | Default | Extra |
+--------------------------+--------------+------+-----+---------+-------+
| datekey                  | int(10)      | NO   | PRI | NULL    |       |
| domain                   | varchar(30)  | NO   | PRI | NULL    |       |
| url                      | varchar(128) | NO   | PRI | NULL    |       |

I have checked that all the primary key field is not null in database.

@dresende
Copy link
Owner

I think I might know what this is. I'm going to investigate.

dresende added a commit that referenced this issue May 29, 2013
…f opts.id (#150)

For multiple primary key tables, it's necessary to use all keys,
otherwise caching will break stuff..
@dresende
Copy link
Owner

Please test the latest commit, it should work ok now.

@dresende
Copy link
Owner

This should be ok now, reopen if the problem persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants