当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Mongo.Collection.find方法代码示例

本文整理汇总了TypeScript中meteor/mongo.Mongo.Collection.find方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Mongo.Collection.find方法的具体用法?TypeScript Mongo.Collection.find怎么用?TypeScript Mongo.Collection.find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在meteor/mongo.Mongo.Collection的用法示例。


在下文中一共展示了Mongo.Collection.find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

Meteor.publish("roomAndMessages", function (roomId: string) {
    check(roomId, String);
    return [
        Rooms.find({ _id: roomId }, { fields: { secretInfo: 0 } }),
        Messages.find({ roomId: roomId })
    ];
});
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:7,代码来源:meteor-tests.ts

示例2: function

 Meteor.publish('common-app.avatar-images', function (_id, counter) {
   if (!_.isArray(_id))
     _id = [_id];
   return [
     AvatarOriginalCollection.find({_id: {$in: _id}, userId: this.userId}),
     AvatarMediumCollection.find({_id: {$in: _id}, userId: this.userId}),
     AvatarThumbCollection.find({_id: {$in: _id}, userId: this.userId})
   ];
 });
开发者ID:kokokenada,项目名称:for-real-cards,代码行数:9,代码来源:avatar.model.ts

示例3: function

	addMessageTask: function (taskId: string, message: string) {
		check(taskId, String);
		check(message, String);
		if (!message.length || message.length < 3) {
			throw new Meteor.Error('400', 'message-to-short');
		}
		if (message.length > 1024) {
			throw new Meteor.Error('400', 'message-to-long');
		}
		// verif user & task
		let user = Meteor.user();
		if (!user) {
			throw new Meteor.Error('403', 'not-authorized');
		}
		let task = Tasks.find({
			_id: taskId,
			$or: [
				{ owner: this.userId },
				{ 'targets.userId': this.userId }
			]
		});
		if (!task) {
			throw new Meteor.Error('403', 'not-authorized');
		}
		Tasks.update(taskId, {
			$push: {
				conversation: {
					message: message,
					createdAt: new Date(),
					owner: user._id,
					ownerEmail: user.emails[0].address
				}
			}
		});
	},
开发者ID:djulls07,项目名称:projects-manager,代码行数:35,代码来源:tasks.ts

示例4: linkFilesModel

export function linkFilesModel(projectId: string, modelName: string, modelId: string, filesIds: Array<string>) {

	let ret = true;
	// check if has right to upload more files for the projectId
	let files = MyFiles.find({ $or: [{ projectId: projectId }, { _id: { $in: filesIds } }] });
	let size = 0;
	files.forEach((file) => {
		size += file.size;
	});
	if (size > process.env.FILES_SIZE_PROJECT) {
		console.log('No space anymore', size + ' > ' + process.env.FILES_SIZE_PROJECT);
		ret = false; // not linking files will result in their removing
	}
	if (ret) {
		console.log('files ids', filesIds);
		MyFiles.update(
		{
			_id: { $in: filesIds }
		},
		{
			$set: {
				modelName: modelName,
				modelId: modelId,
				projectId: projectId
			}
		},
		{
			multi: true
		}
		);
	}
	return ret;
}
开发者ID:djulls07,项目名称:projects-manager,代码行数:33,代码来源:my-files.ts

示例5: function

 Meteor.publish('tasks.public', function() {
   return Tasks.find({
     $or: [
       { private: { $ne: true } },
       { owner: this.userId }
     ]
   });
 });
开发者ID:RichardHwang886,项目名称:todo4,代码行数:8,代码来源:tasks.ts

示例6:

 Meteor.startup(function () {
     if (Rooms.find().count() === 0) {
         Rooms.insert({ name: "Initial room" });
     }
 });
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:5,代码来源:meteor-tests.ts


注:本文中的meteor/mongo.Mongo.Collection.find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。