db.products.find({
	// productName: 
	productName: {
		$in: [
			'QP2520 & QP2530'
		]
	}
}).forEach(function(product) {

	var rs = product.reviewTitles;

	print('reviewTitles are', rs.length)

	db.textcontents.find({
		'appearedOn.title': {
			$in: rs
		}
	}).forEach(function(review) {

		var html = review.html;
		var authorName = review.authorName;

		var hs;
		var tmp;

		// printjson({
		// 	html: html,
		// 	authorName: authorName
		// })

		var count = db.textcontents.count({
			html: html,
			authorName: authorName
		});

		// print(count);

		var msg = '1...';

		if (count > 1) {
			hs = db.textcontents.distinct('hash', {
				html: html,
				authorName: authorName
			});
			tmp = hs.map(function(h) {
				return db.text_reviews_for_analytics.count({
					'review.hash': h,
					state: 0
				});
			});

			printjson(tmp)

			tmp.forEach(function(analyzedCount, index) {
				if (analyzedCount === 0) {
					msg = msg + '1-';
					print(['Some review should be removed...', review.authorName, hs[index]].join('|'))
						// db.text_reviews_for_analytics.remove({
						// 	'review.hash': hs[index]
						// });
						// db.textcontents.remove({
						// 	'hash': hs[index]
						// });
				}
			});
		}

		print(msg)


	});

});