Mongo::Error::OperationFailure Unknown modifier: $pushAll when updating a model (mongoid, angular, rails)
Mongo::Error::OperationFailure Unknown modifier: $pushAll when updating a model (mongoid, angular, rails)
我在前端使用 angular-8,在后端使用 Rails(5.2) 和 Mongoid(6.1)。
我有一个模型 Event
的多级嵌套形式,accepts_nested_attributes_for Ticket
又 accepts_nested_attributes_for Channel
.
每当我尝试更新任何事件并将新的 Channel
添加到事件中的任何 Ticket
时。我收到此错误:
Mongo::Error::OperationFailure (Unknown modifier: $pushAll. Expected a valid update modifier or pipeline-style update specified as an array (9)):
我查了一下发现 here, that $pushAll support is deprecated now and we have to Turn on UsePushEach by default。
但我不知道 在 Rails.
的默认设置中,我应该在哪里配置这个 UsePushEach
如有任何帮助,我们将不胜感激。谢谢!
请注意,您指的是 Mongoose 的 Github 问题,这是一个节点 ODM,并且您正在尝试将他们的设置应用到 Rails。他们完全不同,他们的问题和解决方案并不适用。
在 Mongoid 中,自 Mongoid 6.3 起删除了 pushAll(参见 MONGOID-4499)。您看到此错误是因为您使用的是旧版本的 Mongoid。
升级到最新的 Mongoid(当前为 7.0)应该可以消除此错误。
我在前端使用 angular-8,在后端使用 Rails(5.2) 和 Mongoid(6.1)。
我有一个模型 Event
的多级嵌套形式,accepts_nested_attributes_for Ticket
又 accepts_nested_attributes_for Channel
.
每当我尝试更新任何事件并将新的 Channel
添加到事件中的任何 Ticket
时。我收到此错误:
Mongo::Error::OperationFailure (Unknown modifier: $pushAll. Expected a valid update modifier or pipeline-style update specified as an array (9)):
我查了一下发现 here, that $pushAll support is deprecated now and we have to Turn on UsePushEach by default。
但我不知道 在 Rails.
的默认设置中,我应该在哪里配置这个 UsePushEach如有任何帮助,我们将不胜感激。谢谢!
请注意,您指的是 Mongoose 的 Github 问题,这是一个节点 ODM,并且您正在尝试将他们的设置应用到 Rails。他们完全不同,他们的问题和解决方案并不适用。
在 Mongoid 中,自 Mongoid 6.3 起删除了 pushAll(参见 MONGOID-4499)。您看到此错误是因为您使用的是旧版本的 Mongoid。
升级到最新的 Mongoid(当前为 7.0)应该可以消除此错误。