forest_admin_datasource_mongoid 1.49.0 → 1.50.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db01d7f5c8b6b609e133448f6a0a04fea6d66bf903bdec0bebee68ed8144bcc3
4
- data.tar.gz: 4a39fd87f88b8261343aa58924e004e33ddea8236f57a88e3464e3c46f936ce1
3
+ metadata.gz: e3211c7198e219e6c1e2d103a9e4cd9e9412833d52e03e6c8001b907926d6411
4
+ data.tar.gz: cdaee47898dac90861b1be241fa935c8e5fd4bd37d25e9c3eb79006759d2a166
5
5
  SHA512:
6
- metadata.gz: 0aae29e348c52465f39be79d767ae3055fbf0746b2b44daf237a09efbe9e77afdc6c9911161c99d01b7216ecc3395a50ae4d457ea88137f36f0e99b601a448b4
7
- data.tar.gz: 238edc1eb00d6121db02c154062bd2d62b08228795ce975cb113273f573a99a145a39d1fced9f7394402aabb3ef94df62dd6bf130ea0480fa9e5a2398dc82653
6
+ metadata.gz: 408a20988dd60b5f3ba6f60701e7b7ef6eac83437d4eadcf0a4b458ed25928055a38909399f516bcebca87dc544bc4c48f22fb133db0c85848d9f87df1a36f99
7
+ data.tar.gz: d8080499afe88cda8b973ef1975098aaaaee0382519c586e7187d452df8a47790149d8cb3edee34e466ec8897416c9b24f2a7661b7238f5e2843d066637ef89a
@@ -107,7 +107,11 @@ module ForestAdminDatasourceMongoid
107
107
  schema = Utils::Schema::MongoidSchema.from_model(model).apply_stack(stack, skip_as_models: true)
108
108
 
109
109
  if tree.is_a? Nodes::ConditionTreeBranch
110
- # to check
110
+ # MongoDB refuses `$or: []` and `$and: []`; the toolkit's match_none is an empty Or.
111
+ if tree.conditions.empty?
112
+ return tree.aggregator.casecmp('or').zero? ? { '$expr' => { '$literal' => false } } : {}
113
+ end
114
+
111
115
  return {
112
116
  "$#{tree.aggregator.downcase}" => tree.conditions.map do |condition|
113
117
  compute_match(model, stack, condition, fields)
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceMongoid
2
- VERSION = "1.49.0"
2
+ VERSION = "1.50.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_datasource_mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.49.0
4
+ version: 1.50.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu