mercredi 2 mai 2018

check if bson array include string id

I would like to know if an array of bsons include a string id, something like this:

[186] pry(main)> changed = [BSON::ObjectId('5ae9972ea8abbc3c5484cd5e')] 
=> [BSON::ObjectId('5ae9972ea8abbc3c5484cd5e')]
[187] pry(main)> changed
=> [BSON::ObjectId('5ae9972ea8abbc3c5484cd5e')]
[188] pry(main)> manager_to_remove = "5ae9972ea8abbc3c5484cd5e"
=> "5ae9972ea8abbc3c5484cd5e"
[189] pry(main)> manager_to_remove
=> "5ae9972ea8abbc3c5484cd5e"
[190] pry(main)> changed.include?(manager_to_remove).inspect
=> "false"

I'm always getting false

Thank you!

Aucun commentaire:

Enregistrer un commentaire