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

Upsert error, object.key called on non-object #26

Closed
RomainLK opened this issue Jun 18, 2013 · 3 comments
Closed

Upsert error, object.key called on non-object #26

RomainLK opened this issue Jun 18, 2013 · 3 comments

Comments

@RomainLK
Copy link

Basically, I'm trying to upsert into an empty collection.
Here is my code:

db.metadata.update(
    { category : item.category } ,
    item,
    {upsert : true },
    function(err, doc){ 
    callback(null);
    });

Just before I check if item is not null. Still I get this error:

Error: Object.keys called on non-object
at Function.keys (native)
at checkObject (C:\node\webservice_client\node_modules\nedb\lib\model.js:48:

So far I have modified that function in model.js and checked that the obj is not null. Seems to be working for now.

  if (typeof obj === 'object' && !_.isNull(obj) ) {
@louischatriot
Copy link
Owner

It seems like the bug that happened when one property of a document was null. It has been fixed in v0.7.4, could you upgrade to the latest version, test again and tell me if it works?

@RomainLK
Copy link
Author

Ups indeed, was stuck with v0.7.3 as I forgot to update my package.json to get newer version. Thanks.

@louischatriot
Copy link
Owner

Great :)

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

No branches or pull requests

2 participants