Hi guys,
Today I needed to execute a query to filter some records. Lets say I have a Product Collection(Tables are called Collection in MongoDB) and I have following two fields in my product collection for simplicity.
I have filtered data by 'title' already and I have I want 10 records from 0 by specifying skip and limit.
Now I have another list ('sku' list) that is list contains sku values. I want to retrieve Product list from DB that is not in SKU list. To do this I have used $nin which is a query operator of MongoDB.
more about advance queries go to here
thanks...
Product
I retrieve data from collection like this.
----------------
Id
sku (store keeping unit)
var products = models.Product.find(MongoDBObject("title" -> "atitle") )
.skip(0).limit(10).toList
var products = models.Product.find( {"sku" $nin descendents},
{MongoDBObject("title" -> "atitle")} )
.skip(offest).limit(10).toList
Comments