As per the documentation teaches here under "Reading NoSQL Documents" part.
I copied the exact same code below.
UserModel.find({}, function(error, result) {
if(error) {
console.log("An error happened -> " + JSON.stringify(error));
}
// Do something with the resulting Ottoman models
});
But it's giving me the error
TypeError: First argument needs to be a ViewQuery, SpatialQuery or N1qlQuery.
Why is it producing the error? And what are ViewQuery
, SpatialQuery
and N1qlQuery
?
This is a known issue with regard to using different versions of the Couchbase Node.js SDK than Ottoman.js is using internally. You can either fork Ottoman.js and upgrade the SDK version it is using internally, or you can downgrade your application to match Ottoman.js. This will be resolved in the next release of the Couchbase Node.js SDK and Ottoman.js (it will allow you to specify which version to use internally).