Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rename to whereFirst

  • Loading branch information...
commit 028dc361bb5fa3e62e7a81213b0204f951016d92 1 parent 126c504
@garrensmith authored
View
1  .gitignore
@@ -1 +1,2 @@
node_modules
+lazyboy_test
View
2  docs/viewqueries.md
@@ -31,7 +31,7 @@ It takes two arguments, the propery to search by, and the value of the propery t
`.where(property, value, function(err, items){} )`
- This method always returns an array of the results. The array will be 0 length if none are found.
-`.findFirst(property, value, function(err, item){} )`
+`.whereFirst(property, value, function(err, item){} )`
- This method always returns a single element, and err is non-null if not found.
Album.where("band","coldplay", function (err, albums) {
View
4 lib/query.js
@@ -55,7 +55,7 @@ var Queriable = function () {
};
- this.findFirst = function (property, key, cb) {
+ this.whereFirst = function (property, key, cb) {
this._view(this.model_type + '/'+property,{key: key}, function(err,results) {
@@ -79,7 +79,7 @@ var Queriable = function () {
}); //this._view
- }; //findFirst
+ }; //whereFirst
this.where = function (property, key,cb) {
View
2  specs/find_by_property_spec.js
@@ -47,7 +47,7 @@ describe("Finding by property", function () {
it("Should find first existing user by first name", function (done) {
var User = Model("User");
- User.findFirst("name","Joshua", function (err, user) {
+ User.whereFirst("name","Joshua", function (err, user) {
user.name.should.equal("Joshua");
user.surname.should.equal("James");
done();
Please sign in to comment.
Something went wrong with that request. Please try again.