Search code examples
mongodbkinvey

How to use $elemMatch in kinvey-flex-sdk?


Is there any way, how to use $elemMatch Projection Operators in kinvey-flex-sdk.


Solution

  • You can try this way.

    var dataStore = modules.dataStore({ skipBl: true, useMasterSecret: true });
    var collection = dataStore.collection('<collectionName>');
    var query = new Kinvey.Query();
    query.equalTo('items', { $elemMatch: { item: 'a', qty: { $gte: 23 } } });
    
    collection.find(query, function (error, result) {
    
    });