私は流星で作業を始めました。私の使用には良いようですが、私の文書は9/10回しか得られませんでした。私は何かを間違って実装したと思う。Meteor Collection find()/ fetch()working sometimes場合によっては
私が使っ角度1.5と活字体
私のコレクションは、コレクションがimport {app} from '../../js/lib/app';
import {Locations} from '../../../lib/collections';
export class LocationsService {
locations: any;
constructor(){
console.log('Constructor called');
this.locations = Locations
.find({})
.fetch();
console.log('documents loaded');
console.log(this.locations);
}
public createLocation(any:any){
Locations.insert(any);
}
public updateLocation(identity:any, modifier:any){
Locations.update(identity,modifier);
}
}
app.service('locationsService', LocationsService);
ここコンソールです私のサービスにインポートされます、その後/
import { Mongo } from 'meteor/mongo';
export const Locations= new Mongo.Collection('locations');
でlibフォルダに作成される
.logsは3つの異なるページリフレッシュからのものです:
私が取得ドキュメントの量は完全にランダムであるように見えます。
ランダムではありません。コレクションの準備が整うのを待つ必要があります(ルータで使用している場合) – Mikkel
あなたはそれについてもっと詳しい情報を投稿できますか? – Opaldes