diff --git a/lib/Cursor.ts b/lib/Cursor.ts index 99f23d9..3221ea4 100644 --- a/lib/Cursor.ts +++ b/lib/Cursor.ts @@ -145,4 +145,13 @@ export class Cursor { skip(skip: number): Cursor { 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 { + return new Cursor(this.model, this.conditions, this.cursor.setReadPreference(type)); + } } \ No newline at end of file