本文整理匯總了TypeScript中meteor/mongo.Mongo.Collection.helpers方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Mongo.Collection.helpers方法的具體用法?TypeScript Mongo.Collection.helpers怎麽用?TypeScript Mongo.Collection.helpers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類meteor/mongo.Mongo.Collection
的用法示例。
在下文中一共展示了Mongo.Collection.helpers方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: moment
import { MongoObservable } from "meteor-rxjs";
import { Mongo } from 'meteor/mongo';
import * as moment from "moment";
import { PlacesModel } from '../models/places.model';
let Places = new Mongo.Collection('places');
// fraction() {
// return Fractions.findOne(this.fractionId);
// }
Places.helpers({
getCreatedAtDate() {
return moment(this.createdAt).format("DD.MM.YYYY HH:mm");
}
});
Places.attachSchema(PlacesModel);
export const PlacesCollection = new MongoObservable.Collection(Places);
示例2: moment
import { MongoObservable } from "meteor-rxjs";
import { Mongo } from 'meteor/mongo';
import * as moment from "moment";
import {FractionsCollection} from "fractions.collection";
import { CharactersModel } from '../models/characters.model';
let Characters = new Mongo.Collection('characters');
// fraction() {
// return Fractions.findOne(this.fractionId);
// }
Characters.helpers({
// getFraction() {
// FractionsCollection.findOne({ _id: this.fractionId });
// },
getCreatedAtDate() {
return moment(this.createdAt).format("DD.MM.YYYY HH:mm");
}
});
Characters.attachSchema(CharactersModel);
export const CharactersCollection = new MongoObservable.Collection(Characters);