SwiftORM / MongoDB-StORM

MongoDB Swift ORM
Apache License 2.0
7 stars 6 forks source link

get() by id does not work #4

Open truemetal opened 7 years ago

truemetal commented 7 years ago

This code returns no rows:

let res = Collection()
try? res.get("58d29558a54d7552e223dae3")
let rows = res.rows()

Doing same in robomongo returns correct object:

db.getCollection('collections').find({` _id : ObjectId("58d29558a54d7552e223dae3") })

Working it around like so for now:

let bs = BSON()
bs.append(oid: BSON.OID(id))
guard let cursor = collection.find(query: bs) else { return }