Closed whitfin closed 9 years ago
ObjectID are wrapped into a struct called Bson.ObjectId
In doing so, it is feasible to used those id in future queries.
If you really want to see the binary values of the id, modify you script like this: Here is my use of this lib:
Mongo.connect! |> Mongo.db("testDb") |> Mongo.Db.collection("testColl") |> Mongo.Collection.find(%{}, %{ "_id" => 1 }) |> Stream.map(&(&1[:_id] |> Map.get(:oid) )) |> Enum.to_list
This simply get the property :oid
of the Bson.ObjectId struct. The only property it has.
@jerp ah sweet - yeah this was for debugging etc. Thank you!
I'm extremely new to this, so excuse me if I'm doing something totally wrong. I'm trying to simply retrieve a list of ids currently stored in my collection, and basically end up with a list of hex:
Here is my use of this lib:
I was hoping to be able to just throw the response back into Poison, but it appears to be still in BSON. I've looked through the BSON docs, but can't seem to figure out how to convert this into some default type?
Any help would be appreciated :)