Insert Unique with Where throws error
biomade opened this issue · 4 comments
biomade commented
Here is the next issue
I tried to insert a second record with the unique flag and I get an error stating that where is not a function
Here is the code and the error output
CODE:
var dbNewsletter = db.load('db/newsletter.nosql');
//insert two records
dbNewsletter.insert({name: 'laurie', email: 'laurie@gmail.com'} )
dbNewsletter.insert({name: 'erich', email: 'erich@gmail.com'} )
console.log("inserted two records");
//insert if they don't exist, do unique
dbNewsletter.insert({name: 'laurie', email: 'laurie@gmail.com'}, true).where('name', 'laurie')
dbNewsletter.insert({name: 'mary', email: 'mary@gmail.com'}, true).where('name', 'mary')
ERROR OUTPUT:
`starting application
inserted two records
C:\SourceCode\NoSQLTest\index.js:14
dbNewsletter.insert({name: 'laurie', email: 'laurie@gmail.com'}, true).where('name', 'laurie')
^
TypeError: dbNewsletter.insert(...).where is not a function
at Object.<anonymous> (C:\SourceCode\NoSQLTest\index.js:14:72)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
petersirka commented
Shit, there is a bug. I'll update it (tomorrow) about new version from Total.js framework.
Sorry and thank you!
biomade commented
I have a habit of finding bugs ;-) (where I work, in c#)
Thanks, I look forward to the new release.
I will keep working and will probably have more questions along the way since I new to this.
petersirka commented
Fixed. Try to download latest version from NPM: $ npm install nosql
.
Thank you!
biomade commented
weill do and thanks