Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Oct 30, 2015
2 parents 2fc6604 + be5e698 commit 1354dc0
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 21 deletions.
41 changes: 23 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
language: node_js
node_js:
- "0.10"

- '0.10'
services:
- mongodb

- mongodb
env:
- CI_SERVER=1

- CI_SERVER=1
addons:
code_climate:
code_climate:
repo_token: 9c90177b42d39905ca635b1f6226580dab5799f87f172b66bab4e8df77b67a13

before_install:
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
- echo 'deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.0 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
- echo 'deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.1 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-org-3.1.list
- echo 'deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.0 multiverse'
| sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
- echo 'deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.1 multiverse'
| sudo tee /etc/apt/sources.list.d/mongodb-org-3.1.list
- sudo apt-get update
- sudo apt-get install -y mongodb-org mongodb-org-server mongodb-org-shell mongodb-org-tools

before_script:
- "until nc -z localhost 27017; do echo Waiting for MongoDB; sleep 1; done"
- "mongo --version"
- until nc -z localhost 27017; do echo Waiting for MongoDB; sleep 1; done
- mongo --version
- gulp build

script:
- gulp ci

after_script:
- gulp coverage
- coveralls < coverage/lcov.info
- codeclimate < coverage/lcov.info
- gulp coverage
- coveralls < coverage/lcov.info
- codeclimate < coverage/lcov.info

deploy:
skip_cleanup: true
provider: npm
email: [email protected]
api_key:
secure: A2tBD6QCdYd814GqbVNmVFzQjbAFF+4CK6JhOJEG3ovXwXuVbIlm+tSu6u+/zIS7ChTJ+RDKsY0/AlMrrhP4Qbm8pd0MsGNWMDPelklDXKHj8tw/s3FdXi8bU2Kn8IGAwMY729MMGdShvMbKx71Wt20jPQ/cMf2Bz25j4Q3WEMQ=
on:
branch: release
repo: SierraSoftworks/Iridium
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
## [v6.2.0](https://github.com/sierrasoftworks/iridium/tree/v6.2.0)
- [88b2d60](https://github.com/sierrasoftworks/iridium/commit/88b2d60) Version 6.2.0
- [7e0c6b3](https://github.com/sierrasoftworks/iridium/commit/7e0c6b3) (origin/master, origin/HEAD) ci: Have Travis publish npm versions
- [17edecd](https://github.com/sierrasoftworks/iridium/commit/17edecd) feat: Added one() method to cursor to read a single item from the database
- [fe1ab5f](https://github.com/sierrasoftworks/iridium/commit/fe1ab5f) feat: Added readFrom method to cursor
- [a914a64](https://github.com/sierrasoftworks/iridium/commit/a914a64) Updated Changelog

## [v6.1.1](https://github.com/sierrasoftworks/iridium/tree/v6.1.1)
- [5eb946f](https://github.com/sierrasoftworks/iridium/commit/5eb946f) Version 6.1.1
- [410ec6e](https://github.com/sierrasoftworks/iridium/commit/410ec6e) build: Rebuild all JS for coverage checking
- [f8ebf0e](https://github.com/sierrasoftworks/iridium/commit/f8ebf0e) fix: Handle null config entry correctly
- [297fcdc](https://github.com/sierrasoftworks/iridium/commit/297fcdc) (origin/master, origin/HEAD) Updated CHANGELOG
- [297fcdc](https://github.com/sierrasoftworks/iridium/commit/297fcdc) Updated CHANGELOG
- [30d132c](https://github.com/sierrasoftworks/iridium/commit/30d132c) Updated documentation

## [v6.1.0](https://github.com/sierrasoftworks/iridium/tree/v6.1.0)
Expand Down
2 changes: 1 addition & 1 deletion doc
Submodule doc updated 1 files
+76 −4 classes/cursor.html
33 changes: 33 additions & 0 deletions lib/Cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,30 @@ export class Cursor<TDocument extends { _id?: any }, TInstance> {
}).nodeify(callback);
}

/**
* Retrieves the next item in the result list and then closes the cursor
* @param {function(Error, TInstance)} callback A callback which is triggered when the next item becomes available
* @return {Promise<TInstance>} A promise which is resolved once the item becomes available and the cursor has been closed.
*/
one(callback?: General.Callback<TInstance>): Bluebird<TInstance> {
return new Bluebird<TDocument>((resolve, reject) => {
this.cursor.next((err, result: any) => {
if (err) return reject(err);
return resolve(result);
});
}).then((document) => {
return new Bluebird<TDocument>((resolve, reject) => {
this.cursor.close((err) => {
if (err) return reject(err);
return resolve(<any>document);
});
});
}).then((document) => {
if (!document) return Bluebird.resolve(<TInstance>null);
return this.model.handlers.documentReceived(this.conditions, document,(document, isNew?, isPartial?) => this.model.helpers.wrapDocument(document, isNew, isPartial));
}).nodeify(callback);
}

/**
* Returns a new cursor which behaves the same as this one did before any results were retrieved
* @return {Cursor} The new cursor which starts at the beginning of the results
Expand Down Expand Up @@ -145,4 +169,13 @@ export class Cursor<TDocument extends { _id?: any }, TInstance> {
skip(skip: number): Cursor<TDocument, TInstance> {
return new Cursor(this.model, this.conditions, this.cursor.skip(skip));
}

/**
* Returns a new cursor which will read from the specified node type.
* @param {String} type The type of node to read from - see https://docs.mongodb.org/manual/core/read-preference/
* @return {Cursor} The new cursor which reads from the specified node type
*/
readFrom(type: string): Cursor<TDocument, TInstance> {
return new Cursor(this.model, this.conditions, this.cursor.setReadPreference(type));
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iridium",
"version": "6.1.1",
"version": "6.2.0",
"author": "Benjamin Pannell <[email protected]>",
"description": "A custom lightweight ORM for MongoDB designed for power-users",
"license": "MIT",
Expand Down

0 comments on commit 1354dc0

Please sign in to comment.