Hey @dbergan,
Here is a snippet of code from a blog post that I did:
AccountModel.getByUsername = function(params, callback) {
var query = N1qlQuery.fromString(
"select users.* from `gaming-sample` as usernames " +
"join `gaming-sample` as users on keys (\"user::\" || usernames.uid) " +
"where meta(usernames).id = $1"
);
db.query(query, ["username::" + params.username], function(error, result) {
if(error) {
return callback(error, null);
}
callback(null, result);
});
};
Notice a few things here:
In the query string itself, I am representing parameterized items with a $1. Had I been using more parameterized items I would do $2, $3, etc.
Then in the db.query
call, the second parameter is my array. Each $1, $2, $3, etc. represents the index in the array.
I think you’re getting errors because you’re trying to use an object rather than an array.
Let me know if this solves your problem.
The blog post can be found here:
Best,