CortexObject
// new base custom object -------
class CustomBase extends CortexObject {
static findOne(filter, ...paths) {
const cursor = this.find(filter).skipAcl().limit(1).grant(8);
if (paths.length) {
cursor.paths(...paths);
}
return cursor.hasNext() ? cursor.next() : null;
}
};
CustomBase.as('c_my_object').findOne();
const obj = CustomBase.as('Account').findOne({email: '[email protected]'}, 'name');
// or we can just name the class -------
class c_My_Object extends CortexObject {
static findAllFoos(skip = 0, limit = 100) {
return this.find({c_foo: true}).skip(skip).limit(limit).toList()
}
}
return c_My_Object.findAllFoos();Static Methods
as(objectName)
from(context)
aggregate(pipeline=[])
count(match)
deleteOne(match)
find(match)
insertOne(doc)
setOwner(id, to)
🚧Warning
updateOne(match, doc)
Last updated
Was this helpful?