-
Notifications
You must be signed in to change notification settings - Fork 4
ormjs: Attributes #8
Copy link
Copy link
Open
Description
User.find(
{ active: true },
0,
10,
{ $attributes: ['_id', 'name', 'email'] }
)This will do
static async find (selector, skip = 0, limit = 100, options) {
if (!selector) selector = {}
limit = Math.min(Math.max(limit, 0), 100)
selector._removed = false
const cursor = await this._call('byExample', selector, {skip, limit})
const documents = await cursor.all()
return documents.map(document => {
let doc = document
if (options.$attributes) doc = _.pick(document, options.$attributes)
return this._createModelByDocument(doc)
})
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels