Start a new topic

How to use mongodb positional $ operator?

Hi,


Lets say we have a collection Unit with embedded zones in it:

Units:

{ _id: "123,

   name: "unit1",

  zones: [

     {id: 1, name : "z1", ...},

     {id : 2, name : "z2"}

  ]

}, 

{...

}


How do I use Kinvey datastore query to fetch only zone with id = 2? How do I used mongoDB supported positional operator $  e.g.     something like:

query.equalTo('zone.$.id', 2) ...? Is it supported and how?

1 Comment

Good afternoon Raghavendra,


You can use modules.CollectionAccess in businesslogic to run what are essentially "raw" mongo queries.  You can read more about that over here:


http://devcenter.kinvey.com/html5/reference/business-logic/reference.html#collection-access-module


Thanks,


Login or Signup to post a comment