You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to set up this module in my project using the nano-adapter. I am trying to save a document in this way:
Schema = require('jugglingdb').Schema
schema = new Schema 'nano', { ###config goes here### }
# creating model
User = schema.define 'User',
prop: String
# saving instance
user = User()
user.prop = "testing"
user.save (err, result) ->
console.log "Err", err
console.log "Res", result
it does save the document in the DB correctly but throws this exception:
error: Uncaught exception: __chain__=false, __wrapped__=[__chain__=false, name=TypeError, message=Object.keys called on non-object, stack=TypeError: Object.keys called on non-object
at Function.keys (native)
at Function.AbstractClass._fromDB (/myproject/node_modules/jugglingdb/lib/model.js:202:28)
at /myproject/node_modules/jugglingdb/lib/model.js:317:37
at /myproject/node_modules/jugglingdb-nano/lib/nano.js:105:16
at Request._callback (/myproject/node_modules/jugglingdb-nano/node_modules/nano/nano.js:288:11)
at Request.self.callback (/myproject/node_modules/jugglingdb-nano/node_modules/nano/node_modules/request/request.js:129:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request.<anonymous> (/myproject/node_modules/jugglingdb-nano/node_modules/nano/node_modules/request/request.js:873:14)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/myproject/node_modules/jugglingdb-nano/node_modules/nano/node_modules/request/request.js:824:12)]
I see that inside model.js(317) you have this:
if (rev) {
rev = Model._fromDB(rev);
obj._rev = rev
}
Model._fromDB implementation
AbstractClass._fromDB = function (data) {
if (!data) return;
var definition = this.schema.definitions[this.modelName].properties;
var propNames = Object.keys(data);
...
Obviously data in this case is the revision number which is a string not an object.
Am I missing something? Is this bug related to the nano-adapter?
The text was updated successfully, but these errors were encountered:
I am trying to set up this module in my project using the nano-adapter. I am trying to save a document in this way:
it does save the document in the DB correctly but throws this exception:
I see that inside model.js(317) you have this:
Model._fromDB implementation
Obviously data in this case is the revision number which is a string not an object.
Am I missing something? Is this bug related to the nano-adapter?
The text was updated successfully, but these errors were encountered: