Mam tablica składa się z typu BSON::ObjectId
i chcę go porównać z niektórych identyfikatorów jako ciągi.Porównaj identyfikator ciągu do BSON :: ObjectId
if my_array_of_BSON_ObjectIds.include?(@my_id_as_a_string)
# delete the item from the array
else
# add the item to the array as a BSON::ObjectId
end
To nie działa jak typy są różne, mogę włączyć mój ciąg do BSON::ObjectId
? Jeśli tak to jak?
Działa to dla mnie oid = 'BSON :: ObjectId.from_string ('506144650ed4c08d84000001'), ale nie z' 'Motorower' na Mongoid 4. – Dex