How to use the hazelcast-client.JsonStringDeserializationPolicy.NO_DESERIALIZATION function in hazelcast-client

To help you get started, we’ve selected a few hazelcast-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hazelcast / hazelcast-nodejs-client / code_samples / hazelcast_json_value.js View on Github external
*
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

var Client = require('hazelcast-client').Client;
var Config = require('hazelcast-client').Config;
var Predicates = require('hazelcast-client').Predicates;
var HazelcastJsonValue = require('hazelcast-client').HazelcastJsonValue;
var JsonStringDeserializationPolicy = require('hazelcast-client').JsonStringDeserializationPolicy;

var config = new Config.ClientConfig();
config.serializationConfig.jsonStringDeserializationPolicy = JsonStringDeserializationPolicy.NO_DESERIALIZATION;

Client.newHazelcastClient(config).then(function(hz) {
    var map;
    return hz.getMap('employees').then(function(mp) {
        map = mp;
        var employees = [
            { name: 'Alice', age: 35 },
            { name: 'Andy', age: 22},
            { name: 'Bob', age: 37 }
        ];

        return map.putAll(employees.map(function (employee, index) {
            return [index, new HazelcastJsonValue(JSON.stringify(employee))];
        }));
    }).then(function() {
        return map.valuesWithPredicate(Predicates