我有一个名为groups的集合,其中包含属性url和消息数组。
group
url: 'myGroup'
messages: [{author: 'john', message: 'hello'}, {..},..]
我想从第一个发布功能中获得前50条消息。
我发现了这个,但它从2013年开始,我想知道是否有什么事情发生了变化。如果字段中的$ slice:不再有效,我怎样才能从服务器获得前50条消息? https://github.com/meteor/meteor/issues/978
我的代码:return Groups.find({'url': groupId}, {fields: {'messages': {$slice: 50}}});
服务器上没有可见的错误。唯一的线索来自console.log-结果:
I20150126-11:45:30.154(1)? { _mongo:
I20150126-11:45:30.158(1)? { _connectCallbacks: [ [Function] ],
I20150126-11:45:30.158(1)? _observeMultiplexers:
I20150126-11:45:30.159(1)? { '{"ordered":false,"collectionName":"users","selector":{"_id":"zc4srx6hgoq6iZzG7"},"options":{"transform":null,"fields":{"profile":1,"username":1,"emails":1}}}': [Object],
I20150126-11:45:30.159(1)? '{"ordered":false,"collectionName":"users","selector":{"_id":"zc4srx6hgoq6iZzG7","services.resume.loginTokens.hashedToken":"Paq9jfB5AoQjE+73sddR0qG56jLz2ZL73PtMiKzxt9A="},"options":{"transform":null,"fields":{"_id":1}}}': [Object],
I20150126-11:45:30.159(1)? '{"ordered":false,"collectionName":"meteor_accounts_loginServiceConfiguration","selector":{},"options":{"transform":null,"fields":{"secret":0}}}': [Object],
I20150126-11:45:30.159(1)? '{"ordered":false,"collectionName":"groups","selector":{"private":false},"options":{"transform":null,"fields":{"groupName":1,"url":1}}}': [Object] },
I20150126-11:45:30.159(1)? _onFailoverHook: { nextCallbackId: 4, callbacks: [Object] },
I20150126-11:45:30.159(1)? _docFetcher: { _mongoConnection: [Circular], _callbacksForCacheKey: {} },
I20150126-11:45:30.159(1)? _oplogHandle:
I20150126-11:45:30.159(1)? { _oplogUrl: 'mongodb://127.0.0.1:3001/local',
I20150126-11:45:30.159(1)? _dbName: 'meteor',
I20150126-11:45:30.160(1)? _oplogLastEntryConnection: [Object],
I20150126-11:45:30.160(1)? _oplogTailConnection: [Object],
I20150126-11:45:30.160(1)? _stopped: false,
I20150126-11:45:30.160(1)? _tailHandle: [Object],
I20150126-11:45:30.160(1)? _readyFuture: [Object],
I20150126-11:45:30.160(1)? _crossbar: [Object],
I20150126-11:45:30.160(1)? _lastProcessedTS: [Object],
I20150126-11:45:30.160(1)? _baseOplogSelector: [Object],
I20150126-11:45:30.160(1)? _catchingUpFutures: [] },
I20150126-11:45:30.160(1)? db:
I20150126-11:45:30.160(1)? { domain: null,
I20150126-11:45:30.160(1)? _events: {},
I20150126-11:45:30.161(1)? _maxListeners: 10,
I20150126-11:45:30.161(1)? databaseName: 'meteor',
I20150126-11:45:30.161(1)? serverConfig: [Object],
I20150126-11:45:30.161(1)? options: [Object],
I20150126-11:45:30.161(1)? _applicationClosed: false,
I20150126-11:45:30.161(1)? slaveOk: false,
I20150126-11:45:30.162(1)? bufferMaxEntries: -1,
I20150126-11:45:30.162(1)? native_parser: false,
I20150126-11:45:30.162(1)? bsonLib: [Object],
I20150126-11:45:30.162(1)? bson: [Object],
I20150126-11:45:30.162(1)? bson_deserializer: [Object],
I20150126-11:45:30.162(1)? bson_serializer: [Object],
I20150126-11:45:30.162(1)? _state: 'connected',
I20150126-11:45:30.163(1)? pkFactory: [Object],
I20150126-11:45:30.163(1)? forceServerObjectId: false,
I20150126-11:45:30.163(1)? safe: false,
I20150126-11:45:30.163(1)? notReplied: {},
I20150126-11:45:30.163(1)? isInitializing: true,
I20150126-11:45:30.163(1)? openCalled: true,
I20150126-11:45:30.164(1)? commands: [],
I20150126-11:45:30.164(1)? logger: [Object],
I20150126-11:45:30.164(1)? tag: 1422269128376,
I20150126-11:45:30.164(1)? eventHandlers: [Object],
I20150126-11:45:30.164(1)? serializeFunctions: false,
I20150126-11:45:30.164(1)? raw: false,
I20150126-11:45:30.164(1)? recordQueryStats: false,
I20150126-11:45:30.164(1)? retryMiliSeconds: 1000,
I20150126-11:45:30.164(1)? numberOfRetries: 60,
I20150126-11:45:30.164(1)? readPreference: [Object] },
I20150126-11:45:30.165(1)? _primary: '127.0.0.1:3001' },
I20150126-11:45:30.165(1)? _cursorDescription:
I20150126-11:45:30.165(1)? { collectionName: 'groups',
I20150126-11:45:30.165(1)? selector: { url: 'rR8r4s62cpoMeuzHD', 'users.id': 'zc4srx6hgoq6iZzG7' },
I20150126-11:45:30.165(1)? options: { transform: null, fields: [Object] } },
I20150126-11:45:30.165(1)? _synchronousCursor: null }
提前致谢。