在 Neo4j.rb 8.0.x 中记录持久性
Record Persistence in Neo4j.rb 8.0.x
我正在升级到 Neo4j.rb 版本 8。按照 upgrade guide 中的说明进行操作后,之前通过的规范现在失败了。
具体来说,count
、persisted?
、all
、last
和 find
似乎彼此错乱了。我可以创建一个帐户,看到它是持久的,如果我计算帐户就可以看到它,但如果我查找最后一个帐户或所有帐户,或者尝试从它的 ID 中找到它,就不会看到它。
下面控制台会话的输出。我疯了吗?
[1] pry> account = Account.create(company_name: "Acme Corporation, LLC", street_address: "1234 Fake Lane", city: "Pleasantville", state: "CA", zip: "12345", country: "United States", phone: "555-555-5555", contact_name: "Some Guy", contact_phone: "123-456-7890", contact_email: "someguy@acmecorp.com")
=> #<Account uuid: "30c44118-ac45-4559-b63b-8e82fafb16cd", city: "Pleasantville", company_name: "Acme Corporation, LLC", contact_email: "someguy@acmecorp.com", contact_name: "Some Guy", contact_phone: "123-456-7890", country: "United States", created_at: Thu, 23 Mar 2017 19:13:52 +0000, phone: "555-555-5555", remote_id: nil, state: "CA", street_address: "1234 Fake Lane", updated_at: Thu, 23 Mar 2017 19:13:52 +0000, zip: "12345">
[2] pry> account.persisted?
=> true
[3] pry> Account.count
=> 1
[4] pry> Account.last
=> nil
[5] pry> Account.find(account.id)
Neo4j::ActiveNode::Labels::RecordNotFound: Couldn't find Account with 'uuid'=30c44118-ac45-4559-b63b-8e82fafb16cd
答案是.......重启你的电脑一切正常!!!111
实际上,问题是我在某处删除了数据库而不是停止它,然后安装了一个新副本。
我正在升级到 Neo4j.rb 版本 8。按照 upgrade guide 中的说明进行操作后,之前通过的规范现在失败了。
具体来说,count
、persisted?
、all
、last
和 find
似乎彼此错乱了。我可以创建一个帐户,看到它是持久的,如果我计算帐户就可以看到它,但如果我查找最后一个帐户或所有帐户,或者尝试从它的 ID 中找到它,就不会看到它。
下面控制台会话的输出。我疯了吗?
[1] pry> account = Account.create(company_name: "Acme Corporation, LLC", street_address: "1234 Fake Lane", city: "Pleasantville", state: "CA", zip: "12345", country: "United States", phone: "555-555-5555", contact_name: "Some Guy", contact_phone: "123-456-7890", contact_email: "someguy@acmecorp.com")
=> #<Account uuid: "30c44118-ac45-4559-b63b-8e82fafb16cd", city: "Pleasantville", company_name: "Acme Corporation, LLC", contact_email: "someguy@acmecorp.com", contact_name: "Some Guy", contact_phone: "123-456-7890", country: "United States", created_at: Thu, 23 Mar 2017 19:13:52 +0000, phone: "555-555-5555", remote_id: nil, state: "CA", street_address: "1234 Fake Lane", updated_at: Thu, 23 Mar 2017 19:13:52 +0000, zip: "12345">
[2] pry> account.persisted?
=> true
[3] pry> Account.count
=> 1
[4] pry> Account.last
=> nil
[5] pry> Account.find(account.id)
Neo4j::ActiveNode::Labels::RecordNotFound: Couldn't find Account with 'uuid'=30c44118-ac45-4559-b63b-8e82fafb16cd
答案是.......重启你的电脑一切正常!!!111
实际上,问题是我在某处删除了数据库而不是停止它,然后安装了一个新副本。