Start a new topic

Querying a collections id?

I'm writing a Java Business Logic Endpoint and I wish to run a query over a collections "_id". I'm aware that the ids are BSON objects so I've looked into converting my id string to a BSON object to run a query using that. I've approached this using org.bson.types.ObjectId to no avail, creating a new "ObjectId" object appears to cause a NullReferenceException on GAE within the ObjectIds initialisation method (even when no argument is provided). After digging into the ObjectId.java source it *seems* to be because "NetworkInterface" is unsurprisingly not supported by AppEngine.



From my research it looks like BSON conversion used to be supported using Kinveys collection access work and I wondered if theres anything similar available in the Java Library?
1 Comment

Hey,



you shouldn't have to treat the _id as a BSON object-- you should be able to just query it directly as a String.



What kind of query are you doing? You can use `AppData.get`, with a `Query` object. Take a look here for more information: http://devcenter.kinvey.com/java/guides/datastore#querying
Login or Signup to post a comment