This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> db.product.find().pretty() | |
{ | |
"_id" : ObjectId("4faec33dd57e4ace158b7e9f"), | |
"type" : "Shirt", | |
"color" : "Green", | |
"sizes" : { | |
"L" : 2, | |
"XL" : 3, | |
"XXL" : 4 | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map = function map(){ | |
//key olarak product type | |
//value olarak ise obje icinde product price alanına gore mapliyoruz | |
emit(this.type, {price:this.price} ); | |
} | |
reduce = function reduce(key,values) { | |
var result = { sumProductPrice: 0 }; | |
values.forEach(function(value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map = function map(){ | |
var size; | |
for (size in this.sizes) { | |
emit(size, this.sizes[size]); | |
} | |
}; | |
reduce = function reduce(key,values){ | |
var result = { count: 0 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map = function(){ | |
var size; | |
for (size in this.sizes) { | |
emit(size, {size: this.sizes[size], price: this.sizes[size] * this.price }); | |
} | |
}; | |
reduce = function reduce(key,values){ | |
var result = { sizeCount: 0, priceCount: 0 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map = function map() { | |
emit(this.type, {productIds : [this._id]}) | |
} | |
reduce = function reduce(key, values) { | |
var productIds = []; | |
var result = { productIds:[] }; | |
values.forEach(function(value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map = function map() { | |
emit(this.type, {productColor :[this.color]}); | |
} | |
reduce = function reduce(key, values) { | |
var colors = []; | |
var results = { colors:[] }; | |
values.forEach(function(value){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map = function map() { | |
emit(this.type, {productColors :[this.color]}); | |
} | |
reduce = function reduce(key, values) { | |
var colors = []; | |
var results = { colors:[] }; | |
values.forEach(function(value){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
<!-- Spring Framework --> | |
<spring-framework.version>3.1.1.RELEASE</spring-framework.version> | |
<!-- Hazelcast --> | |
<hazelcast.version>2.0.2</hazelcast.version> | |
</properties> | |
<dependencies> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:context="http://www.springframework.org/schema/context" | |
xmlns:hz="http://www.hazelcast.com/schema/spring" | |
xsi:schemaLocation="http://www.springframework.org/schema/context | |
http://www.springframework.org/schema/context/spring-context-3.1.xsd | |
http://www.springframework.org/schema/beans | |
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd | |
http://www.hazelcast.com/schema/spring |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.umitunal.hazelcast; | |
import static org.junit.Assert.*; | |
import javax.annotation.Resource; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.springframework.test.context.ContextConfiguration; | |
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
OlderNewer