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


TypeScript mongodb.ObjectID函数代码示例

本文整理汇总了TypeScript中mongodb.ObjectID函数的典型用法代码示例。如果您正苦于以下问题:TypeScript ObjectID函数的具体用法?TypeScript ObjectID怎么用?TypeScript ObjectID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: function

		router.get('/edit',function(req, res) {
			var db = req.db;
			var registeredUsers = db.get('registeredUsers');
			registeredUsers.findOne({_id:ObjectID(req.cookies._id)}, function(err, user) {
					res.render('editprofile', {"user":user});
			});
		});
开发者ID:TylerWardle,项目名称:MATA_Clone,代码行数:7,代码来源:profile.ts

示例2: getContributor

	getContributor(req: any, res: any): Boolean {
	    var db = req.db;
        var contributors = db.get('contributors');
        var registeredUsers = db.get('registeredUsers');
        var comicsDB = db.get('comics');
        var c = new Comic.Comic(req.mongoose);
        var cc = new ComicCell.ComicCell(req.mongoose);
        var s = new Service.SearchBrowseService(req.mongoose);
        var history = new HistoryServiceProvider.HistoryServiceProvider();
            
      	registeredUsers.findOne({_id: ObjectID(req.cookies._id)}, function(error, contributor)
    	{
            s.getComics(req,(comics:any): void =>{
                registeredUsers.find({username: {$in: contributor.subscriptions}}, function(err, users) {
                    comicsDB.find({_id: {$in: contributor.webComicViewingHistory}} , {sort: {_id:-1}}, function(err, comicsViewed) {
         		        res.render('contributor',{  "users": users, 
                                                    "contributor": contributor,
                                                    "header": req.headers['host'] + "/webcomic/",
                                                    "comics": comics,
                                                    "viewedComics": comicsViewed
                                                    });
                    });
                });    	
            });	
        });

		return true;
	}
开发者ID:TylerWardle,项目名称:MATA_Clone,代码行数:28,代码来源:ContributorServiceProvider.ts

示例3: ObjectID

            this.connect(function (err: any, db: any) {
                assert.equal(null, err);



                db.collection(name).findOne({ "_id": ObjectID(id) }, function (err: any, doc: any) {
                    if (err !== null || doc === null)
                        callback({ "error": "not found" });
                    else
                        callback(doc);
                });


            });
开发者ID:gitter-badger,项目名称:nodulus,代码行数:14,代码来源:mongodb.ts

示例4: function

		router.get('/', function(req, res, db) {
			//console.log("Reached");
			var db = req.db;
			var registeredUsers = db.get('registeredUsers');
			
			registeredUsers.findOne({_id: ObjectID(req.cookies._id)}, function(error, user)
			{
				if(user.accountType == 'viewer'){
					 res.redirect('viewer');

				}else{
					res.redirect('contributor');  
				}
			});
		});
开发者ID:TylerWardle,项目名称:MATA_Clone,代码行数:15,代码来源:home.ts

示例5: function

						viewers.findOne({guid:ObjectID(req.cookies._id)}, function(err, viewer) {
							if (err) {
								res.send("ACCESS DENIED" + err);
							}
							else
							{
								// need to ask client to give format of data being sent up for account settings..
								// are they only sending updated settings? or all.
								viewers.update({guid:ObjectID(req.cookies._id)},{
									username: viewer.username,
									firstName: req.body.firstName,
									lastName: req.body.lastName,
									guid: viewer.guid
								})
							}
						});
开发者ID:TylerWardle,项目名称:MATA_Clone,代码行数:16,代码来源:AccountSettingsServiceProvider.ts

示例6: getAccountSettings

	getAccountSettings(req: any, res: any): Boolean
	{
		var db = req.db;
		var registeredUsers = db.get('registeredUsers');
			
			 // Fetch the document
			registeredUsers.findOne({_id:ObjectID(req.cookies._id)}, function(err, user) {
				if(user)
				{			
				   res.render('accountsettings', { "accountsettings": user });
				}else
				{
					res.send("ACCESS DENIED");
				}
			});
		
		return true;
	}
开发者ID:TylerWardle,项目名称:MATA_Clone,代码行数:18,代码来源:AccountSettingsServiceProvider.ts

示例7: getViewer

	getViewer(req: any, res: any): Boolean {
		var db = req.db;
		var viewers = db.get('viewers');
        var c = new Comic.Comic(req.mongoose);
		var cc = new ComicCell.ComicCell(req.mongoose);
		var s = new Service.SearchBrowseService(req.mongoose);
		//var comicsList = "https://fast-beach-12058.herokuapp.com/webcomic/id/56bac1a83da2ef110089f60e, https://fast-beach-12058.herokuapp.com/webcomic/id/56bac1a83da2ef110089f60f";
				
		viewers.findOne({guid: ObjectID(req.cookies._id)}, function(error, viewer)
		{
			s.getComicsForViewer(req,(comics:any): void =>{
		        res.render('viewer',{"viewer": viewer,"header": req.headers['host'] + "/webcomic/", "comics": comics});    
            }); 

		});

		return true;
	}
开发者ID:TylerWardle,项目名称:MATA_Clone,代码行数:18,代码来源:ViewerServiceProvider.ts

示例8: function

 cc.insert(comicID, authorID, authorID, toPublish, (imgName: String): void=> {
     // If there's an error
     if (!imgName) {
         console.log("There was an error")
         res.redirect("./create");
         res.end();
     } else {
         //var newPath = "./uploads/fullsize/" + imgName;
         c.update(comicID, title, authorID, authorUsername, publicationDate, description, genre, toPublish, openToContribution, openToCommenting, imgName, upvotes,votedPpl,fave, (): void => {});
         var newPath = "./uploads/fullsize/" + imgName;
         //var imageList = [(req.headers['host'] + "/webcomic/image/" + imgName)];
 
         // write image file to uploads/fullsize folder
         fs.writeFile(newPath, img, function (err) {
             if (err)
                 return console.error(err);
             //redirect to the newly created comic
             res.redirect('./id/' + comicID);
         });
         easyimg.rescrop({
             src: newPath, dst:'./uploads/thumbnails/' + imgName,
             width:128, height:128,
             //cropwidth:128, cropheight:128,
             x:0, y:0
             }).then(
             function(image) {
                 console.log('Resized and cropped: ' + image.width + ' x ' + image.height);
             },
             function (err) {
                 console.log(err);
             }
             );
     }
     
     var db = req.db;
     var contributors = db.get('contributors');
     contributors.update({ guid: ObjectId(req.cookies._id) }, {
         $addToSet: {
             comicIDs: [comicID]
         }
     });
     
 });
开发者ID:TylerWardle,项目名称:MATA_Clone,代码行数:43,代码来源:webcomic.ts

示例9:

 jobs.forEach((job: any) => {
     const temp = JSON.parse(JSON.stringify(job));
     logs[temp['_id']] = [];
     ids.push(ObjectId(temp['_id']));
 });
开发者ID:damisv,项目名称:steemBotJobs,代码行数:5,代码来源:logs.router.ts


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