Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

Error when trying to retrieve value by key from BSON object #45

@drum445

Description

@drum445

Below error when trying to retrieve value by key from a BSON object

Error in src/api.cr:8: instantiating 'Mongo::Collection#find(Hash(String, Hash(String, Int32)))'

collection.find({"age" => {"$gt" => 30}}) do |doc|
           ^~~~

in lib/mongo/src/mongo/collection.cr:133: instantiating 'Mongo::Cursor#each()'

    find(query, fields, flags, skip, limit, batch_size, prefs).each do |doc|
                                                               ^~~~

in lib/mongo/src/mongo/collection.cr:133: instantiating 'Mongo::Cursor#each()'

    find(query, fields, flags, skip, limit, batch_size, prefs).each do |doc|
                                                               ^~~~

in src/api.cr:8: instantiating 'Mongo::Collection#find(Hash(String, Hash(String, Int32)))'

collection.find({"age" => {"$gt" => 30}}) do |doc|
           ^~~~

in src/api.cr:10: instantiating 'BSON#[](String)'

  puts doc["age"]
          ^

in lib/mongo/src/bson.cr:127: instantiating 'fetch(String)'

    fetch(key) { raise IndexError.new }
    ^~~~~

in lib/mongo/src/bson.cr:116: instantiating 'BSON::Value#value()'

      Value.new(value).value
                       ^~~~~

in lib/mongo/src/bson/value.cr:42: undefined constant Time::Kind::Utc

        Time.new(spec, Time::Kind::Utc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions