に私はmongoidといくつかの問題を持っていない:Mongoidは、クエリ
test "Test candidate" do
User.create(:id => 1, :sex => User::Male, :country => 1, :city => 1)
User.create(:id => 2, :sex => User::Female, :country => 1, :city => 1)
User.create(:id => 3, :sex => User::Female, :country => 1, :city => 1)
user = User.not_in(:id => [2]).second
assert_not_equal(user.id, 2)
end
テストに失敗しました。私はどこで使用しようとしましたか(:id => {'$ nid' => [2]})、それと同じ効果があります。
どうしたのですか?モンゴイドで "not in"状態を使用するには? MongoDBの主キーで
user = User.not_in(:_id => [2]).second
名_id
があります。id = 1