Debian Codegraph @

mysql-test/suite/x/r/crud_doc_criteria_args.result

raw
1 =============================================
2 CRUD DOC CRITERIA ARGS SCENARIOS
3 =============================================
4
5 ================================================================================
6 PREAMBLE
7 ================================================================================
8 ================================================================================
9 TEST START
10 ================================================================================
11 create schema xtest;
12
13 command ok
14 RUN use xtest
15
16 0 rows affected
17 RUN insert into mycoll (doc) values ('{"_id": "1", "name": "Robb", "amount": 125.21}')
18
19 1 rows affected
20 RUN insert into mycoll (doc) values ('{"_id": "2", "name": "Bran", "amount": 542.75}')
21
22 1 rows affected
23 RUN insert into mycoll (doc) values ('{"_id": "3", "name": "Arya", "amount": 98.89}')
24
25 1 rows affected
26 RUN insert into mycoll (doc) values ('{"_id": "4", "name": "Tassadar", "amount": 57.52}')
27
28 1 rows affected
29 RUN insert into mycoll (doc) values ('{"_id": "5", "name": "Sansa", "amount": null}')
30
31 1 rows affected
32 RUN select doc FROM xtest.mycoll
33 doc
34 {"_id": "1", "name": "Robb", "amount": 125.21}
35 {"_id": "2", "name": "Bran", "amount": 542.75}
36 {"_id": "3", "name": "Arya", "amount": 98.89}
37 {"_id": "4", "name": "Tassadar", "amount": 57.52}
38 {"_id": "5", "name": "Sansa", "amount": null}
39 0 rows affected
40 Find with > Operator and placeholder
41 send Mysqlx.Crud.Find {
42 collection {
43 name: "mycoll"
44 schema: "xtest"
45 }
46 data_model: DOCUMENT
47 criteria {
48 type: OPERATOR
49 operator {
50 name: ">"
51 param {
52 type: IDENT
53 identifier {
54 document_path {
55 type: MEMBER
56 value: "amount"
57 }
58 }
59 }
60 param {
61 type: PLACEHOLDER
62 position: 0
63 }
64 }
65 }
66 args {
67 type: V_DOUBLE
68 v_double: 98.89
69 }
70 }
71
72 doc
73 {"_id": "1", "name": "Robb", "amount": 125.21}
74 {"_id": "2", "name": "Bran", "amount": 542.75}
75 command ok
76 Find with < Operator and placeholder
77 send Mysqlx.Crud.Find {
78 collection {
79 name: "mycoll"
80 schema: "xtest"
81 }
82 data_model: DOCUMENT
83 criteria {
84 type: OPERATOR
85 operator {
86 name: "<"
87 param {
88 type: IDENT
89 identifier {
90 document_path {
91 type: MEMBER
92 value: "amount"
93 }
94 }
95 }
96 param {
97 type: PLACEHOLDER
98 position: 0
99 }
100 }
101 }
102 args {
103 type: V_DOUBLE
104 v_double: 98.89
105 }
106 }
107
108 doc
109 {"_id": "4", "name": "Tassadar", "amount": 57.52}
110 {"_id": "5", "name": "Sansa", "amount": null}
111 command ok
112 Find with >= Operator and placeholder
113 send Mysqlx.Crud.Find {
114 collection {
115 name: "mycoll"
116 schema: "xtest"
117 }
118 data_model: DOCUMENT
119 criteria {
120 type: OPERATOR
121 operator {
122 name: ">="
123 param {
124 type: IDENT
125 identifier {
126 document_path {
127 type: MEMBER
128 value: "amount"
129 }
130 }
131 }
132 param {
133 type: PLACEHOLDER
134 position: 0
135 }
136 }
137 }
138 args {
139 type: V_DOUBLE
140 v_double: 98.89
141 }
142 }
143
144 doc
145 {"_id": "1", "name": "Robb", "amount": 125.21}
146 {"_id": "2", "name": "Bran", "amount": 542.75}
147 {"_id": "3", "name": "Arya", "amount": 98.89}
148 command ok
149 Find with <= Operator and placeholder
150 send Mysqlx.Crud.Find {
151 collection {
152 name: "mycoll"
153 schema: "xtest"
154 }
155 data_model: DOCUMENT
156 criteria {
157 type: OPERATOR
158 operator {
159 name: "<="
160 param {
161 type: IDENT
162 identifier {
163 document_path {
164 type: MEMBER
165 value: "amount"
166 }
167 }
168 }
169 param {
170 type: PLACEHOLDER
171 position: 0
172 }
173 }
174 }
175 args {
176 type: V_DOUBLE
177 v_double: 98.89
178 }
179 }
180
181 doc
182 {"_id": "3", "name": "Arya", "amount": 98.89}
183 {"_id": "4", "name": "Tassadar", "amount": 57.52}
184 {"_id": "5", "name": "Sansa", "amount": null}
185 command ok
186 Find with <= Operator, placeholder and Order desc
187 send Mysqlx.Crud.Find {
188 collection {
189 name: "mycoll"
190 schema: "xtest"
191 }
192 data_model: DOCUMENT
193 criteria {
194 type: OPERATOR
195 operator {
196 name: "!="
197 param {
198 type: IDENT
199 identifier {
200 document_path {
201 type: MEMBER
202 value: "amount"
203 }
204 }
205 }
206 param {
207 type: PLACEHOLDER
208 position: 0
209 }
210 }
211 }
212 order {
213 expr {
214 type: IDENT
215 identifier {
216 name: "_id"
217 }
218 }
219 direction: DESC
220 }
221 args {
222 type: V_DOUBLE
223 v_double: 0
224 }
225 }
226
227 doc
228 {"_id": "5", "name": "Sansa", "amount": null}
229 {"_id": "4", "name": "Tassadar", "amount": 57.52}
230 {"_id": "3", "name": "Arya", "amount": 98.89}
231 {"_id": "2", "name": "Bran", "amount": 542.75}
232 {"_id": "1", "name": "Robb", "amount": 125.21}
233 command ok
234 Find with <= Operator, placeholder and Order asc
235 send Mysqlx.Crud.Find {
236 collection {
237 name: "mycoll"
238 schema: "xtest"
239 }
240 data_model: DOCUMENT
241 criteria {
242 type: OPERATOR
243 operator {
244 name: "!="
245 param {
246 type: IDENT
247 identifier {
248 document_path {
249 type: MEMBER
250 value: "amount"
251 }
252 }
253 }
254 param {
255 type: PLACEHOLDER
256 position: 0
257 }
258 }
259 }
260 order {
261 expr {
262 type: IDENT
263 identifier {
264 name: "_id"
265 }
266 }
267 direction: ASC
268 }
269 args {
270 type: V_DOUBLE
271 v_double: 0
272 }
273 }
274
275 doc
276 {"_id": "1", "name": "Robb", "amount": 125.21}
277 {"_id": "2", "name": "Bran", "amount": 542.75}
278 {"_id": "3", "name": "Arya", "amount": 98.89}
279 {"_id": "4", "name": "Tassadar", "amount": 57.52}
280 {"_id": "5", "name": "Sansa", "amount": null}
281 command ok
282 Find with == Operator and placeholder
283 send Mysqlx.Crud.Find {
284 collection {
285 name: "mycoll"
286 schema: "xtest"
287 }
288 data_model: DOCUMENT
289 criteria {
290 type: OPERATOR
291 operator {
292 name: "=="
293 param {
294 type: IDENT
295 identifier {
296 document_path {
297 type: MEMBER
298 value: "name"
299 }
300 }
301 }
302 param {
303 type: PLACEHOLDER
304 position: 0
305 }
306 }
307 }
308 args {
309 type: V_STRING
310 v_string {
311 value: "Robb"
312 }
313 }
314 }
315
316 doc
317 {"_id": "1", "name": "Robb", "amount": 125.21}
318 command ok
319 Find with != Operator and placeholder
320 send Mysqlx.Crud.Find {
321 collection {
322 name: "mycoll"
323 schema: "xtest"
324 }
325 data_model: DOCUMENT
326 criteria {
327 type: OPERATOR
328 operator {
329 name: "!="
330 param {
331 type: IDENT
332 identifier {
333 document_path {
334 type: MEMBER
335 value: "name"
336 }
337 }
338 }
339 param {
340 type: PLACEHOLDER
341 position: 0
342 }
343 }
344 }
345 args {
346 type: V_STRING
347 v_string {
348 value: "Robb"
349 }
350 }
351 }
352
353 doc
354 {"_id": "2", "name": "Bran", "amount": 542.75}
355 {"_id": "3", "name": "Arya", "amount": 98.89}
356 {"_id": "4", "name": "Tassadar", "amount": 57.52}
357 {"_id": "5", "name": "Sansa", "amount": null}
358 command ok
359 Find with in Operator and placeholder
360 send Mysqlx.Crud.Find {
361 collection {
362 name: "mycoll"
363 schema: "xtest"
364 }
365 data_model: DOCUMENT
366 criteria {
367 type: OPERATOR
368 operator {
369 name: "in"
370 param {
371 type: IDENT
372 identifier {
373 document_path {
374 type: MEMBER
375 value: "_id"
376 }
377 }
378 }
379 param {
380 type: PLACEHOLDER
381 position: 0
382 }
383 }
384 }
385 args {
386 type: V_STRING
387 v_string {
388 value: "3"
389 }
390 }
391 }
392
393 doc
394 {"_id": "3", "name": "Arya", "amount": 98.89}
395 command ok
396 Find with not_in Operator and placeholder
397 send Mysqlx.Crud.Find {
398 collection {
399 name: "mycoll"
400 schema: "xtest"
401 }
402 data_model: DOCUMENT
403 criteria {
404 type: OPERATOR
405 operator {
406 name: "not_in"
407 param {
408 type: IDENT
409 identifier {
410 document_path {
411 type: MEMBER
412 value: "_id"
413 }
414 }
415 }
416 param {
417 type: PLACEHOLDER
418 position: 0
419 }
420 }
421 }
422 args {
423 type: V_STRING
424 v_string {
425 value: "3"
426 }
427 }
428 }
429
430 doc
431 {"_id": "1", "name": "Robb", "amount": 125.21}
432 {"_id": "2", "name": "Bran", "amount": 542.75}
433 {"_id": "4", "name": "Tassadar", "amount": 57.52}
434 {"_id": "5", "name": "Sansa", "amount": null}
435 command ok
436 Update with == operator and placeholder
437 send Mysqlx.Crud.Update {
438 collection {
439 name: "mycoll"
440 schema: "xtest"
441 }
442 data_model: DOCUMENT
443 criteria {
444 type: OPERATOR
445 operator {
446 name: "=="
447 param {
448 type: IDENT
449 identifier {
450 document_path {
451 type: MEMBER
452 value: "amount"
453 }
454 }
455 }
456 param {
457 type: PLACEHOLDER
458 position: 0
459 }
460 }
461 }
462 operation {
463 source {
464 document_path {
465 type: MEMBER
466 value: "name"
467 }
468 }
469 operation: ITEM_SET
470 value {
471 type: LITERAL
472 literal {
473 type: V_OCTETS
474 v_octets {
475 value: "Update_=="
476 }
477 }
478 }
479 }
480 args {
481 type: V_DOUBLE
482 v_double: 98.89
483 }
484 }
485
486
487 1 rows affected
488 Rows matched: 1 Changed: 1 Warnings: 0
489 RUN select doc FROM xtest.mycoll
490 doc
491 {"_id": "1", "name": "Robb", "amount": 125.21}
492 {"_id": "2", "name": "Bran", "amount": 542.75}
493 {"_id": "3", "name": "Update_==", "amount": 98.89}
494 {"_id": "4", "name": "Tassadar", "amount": 57.52}
495 {"_id": "5", "name": "Sansa", "amount": null}
496 0 rows affected
497 Update with > operator and placeholder
498 send Mysqlx.Crud.Update {
499 collection {
500 name: "mycoll"
501 schema: "xtest"
502 }
503 data_model: DOCUMENT
504 criteria {
505 type: OPERATOR
506 operator {
507 name: ">"
508 param {
509 type: IDENT
510 identifier {
511 document_path {
512 type: MEMBER
513 value: "amount"
514 }
515 }
516 }
517 param {
518 type: PLACEHOLDER
519 position: 0
520 }
521 }
522 }
523 operation {
524 source {
525 document_path {
526 type: MEMBER
527 value: "name"
528 }
529 }
530 operation: ITEM_SET
531 value {
532 type: LITERAL
533 literal {
534 type: V_OCTETS
535 v_octets {
536 value: "Update_>"
537 }
538 }
539 }
540 }
541 args {
542 type: V_DOUBLE
543 v_double: 98.89
544 }
545 }
546
547
548 2 rows affected
549 Rows matched: 2 Changed: 2 Warnings: 0
550 RUN select doc FROM xtest.mycoll
551 doc
552 {"_id": "1", "name": "Update_>", "amount": 125.21}
553 {"_id": "2", "name": "Update_>", "amount": 542.75}
554 {"_id": "3", "name": "Update_==", "amount": 98.89}
555 {"_id": "4", "name": "Tassadar", "amount": 57.52}
556 {"_id": "5", "name": "Sansa", "amount": null}
557 0 rows affected
558 Update with >= operator and placeholder
559 send Mysqlx.Crud.Update {
560 collection {
561 name: "mycoll"
562 schema: "xtest"
563 }
564 data_model: DOCUMENT
565 criteria {
566 type: OPERATOR
567 operator {
568 name: ">="
569 param {
570 type: IDENT
571 identifier {
572 document_path {
573 type: MEMBER
574 value: "amount"
575 }
576 }
577 }
578 param {
579 type: PLACEHOLDER
580 position: 0
581 }
582 }
583 }
584 operation {
585 source {
586 document_path {
587 type: MEMBER
588 value: "name"
589 }
590 }
591 operation: ITEM_SET
592 value {
593 type: LITERAL
594 literal {
595 type: V_OCTETS
596 v_octets {
597 value: "Update_>="
598 }
599 }
600 }
601 }
602 args {
603 type: V_DOUBLE
604 v_double: 98.89
605 }
606 }
607
608
609 3 rows affected
610 Rows matched: 3 Changed: 3 Warnings: 0
611 RUN select doc FROM xtest.mycoll
612 doc
613 {"_id": "1", "name": "Update_>=", "amount": 125.21}
614 {"_id": "2", "name": "Update_>=", "amount": 542.75}
615 {"_id": "3", "name": "Update_>=", "amount": 98.89}
616 {"_id": "4", "name": "Tassadar", "amount": 57.52}
617 {"_id": "5", "name": "Sansa", "amount": null}
618 0 rows affected
619 Update with <= operator and placeholder
620 send Mysqlx.Crud.Update {
621 collection {
622 name: "mycoll"
623 schema: "xtest"
624 }
625 data_model: DOCUMENT
626 criteria {
627 type: OPERATOR
628 operator {
629 name: "<="
630 param {
631 type: IDENT
632 identifier {
633 document_path {
634 type: MEMBER
635 value: "amount"
636 }
637 }
638 }
639 param {
640 type: PLACEHOLDER
641 position: 0
642 }
643 }
644 }
645 operation {
646 source {
647 document_path {
648 type: MEMBER
649 value: "name"
650 }
651 }
652 operation: ITEM_SET
653 value {
654 type: LITERAL
655 literal {
656 type: V_OCTETS
657 v_octets {
658 value: "Update_<="
659 }
660 }
661 }
662 }
663 args {
664 type: V_DOUBLE
665 v_double: 98.89
666 }
667 }
668
669
670 3 rows affected
671 Rows matched: 3 Changed: 3 Warnings: 0
672 RUN select doc FROM xtest.mycoll
673 doc
674 {"_id": "1", "name": "Update_>=", "amount": 125.21}
675 {"_id": "2", "name": "Update_>=", "amount": 542.75}
676 {"_id": "3", "name": "Update_<=", "amount": 98.89}
677 {"_id": "4", "name": "Update_<=", "amount": 57.52}
678 {"_id": "5", "name": "Update_<=", "amount": null}
679 0 rows affected
680 Update with Float operator and placeholder
681 send Mysqlx.Crud.Update {
682 collection {
683 name: "mycoll"
684 schema: "xtest"
685 }
686 data_model: DOCUMENT
687 criteria {
688 type: OPERATOR
689 operator {
690 name: "=="
691 param {
692 type: IDENT
693 identifier {
694 document_path {
695 type: MEMBER
696 value: "name"
697 }
698 }
699 }
700 param {
701 type: PLACEHOLDER
702 position: 0
703 }
704 }
705 }
706 operation {
707 source {
708 document_path {
709 type: MEMBER
710 value: "amount"
711 }
712 }
713 operation: ITEM_SET
714 value {
715 type: LITERAL
716 literal {
717 type: V_FLOAT
718 v_float: 256.51
719 }
720 }
721 }
722 args {
723 type: V_STRING
724 v_string {
725 value: "Update_<="
726 }
727 }
728 }
729
730
731 3 rows affected
732 Rows matched: 3 Changed: 3 Warnings: 0
733 RUN select doc FROM xtest.mycoll
734 doc
735 {"_id": "1", "name": "Update_>=", "amount": 125.21}
736 {"_id": "2", "name": "Update_>=", "amount": 542.75}
737 {"_id": "3", "name": "Update_<=", "amount": 256.51}
738 {"_id": "4", "name": "Update_<=", "amount": 256.51}
739 {"_id": "5", "name": "Update_<=", "amount": 256.51}
740 0 rows affected
741 Update with Double operator and placeholder
742 send Mysqlx.Crud.Update {
743 collection {
744 name: "mycoll"
745 schema: "xtest"
746 }
747 data_model: DOCUMENT
748 criteria {
749 type: OPERATOR
750 operator {
751 name: "=="
752 param {
753 type: IDENT
754 identifier {
755 document_path {
756 type: MEMBER
757 value: "name"
758 }
759 }
760 }
761 param {
762 type: PLACEHOLDER
763 position: 0
764 }
765 }
766 }
767 operation {
768 source {
769 document_path {
770 type: MEMBER
771 value: "amount"
772 }
773 }
774 operation: ITEM_SET
775 value {
776 type: LITERAL
777 literal {
778 type: V_DOUBLE
779 v_double: 256.51
780 }
781 }
782 }
783 args {
784 type: V_STRING
785 v_string {
786 value: "Update_>="
787 }
788 }
789 }
790
791
792 2 rows affected
793 Rows matched: 2 Changed: 2 Warnings: 0
794 RUN select doc FROM xtest.mycoll
795 doc
796 {"_id": "1", "name": "Update_>=", "amount": 256.51}
797 {"_id": "2", "name": "Update_>=", "amount": 256.51}
798 {"_id": "3", "name": "Update_<=", "amount": 256.51}
799 {"_id": "4", "name": "Update_<=", "amount": 256.51}
800 {"_id": "5", "name": "Update_<=", "amount": 256.51}
801 0 rows affected
802 Update with String operator and placeholder
803 send Mysqlx.Crud.Update {
804 collection {
805 name: "mycoll"
806 schema: "xtest"
807 }
808 data_model: DOCUMENT
809 criteria {
810 type: OPERATOR
811 operator {
812 name: "=="
813 param {
814 type: IDENT
815 identifier {
816 document_path {
817 type: MEMBER
818 value: "amount"
819 }
820 }
821 }
822 param {
823 type: PLACEHOLDER
824 position: 0
825 }
826 }
827 }
828 operation {
829 source {
830 document_path {
831 type: MEMBER
832 value: "name"
833 }
834 }
835 operation: ITEM_SET
836 value {
837 type: LITERAL
838 literal {
839 type: V_STRING
840 v_string {
841 value: "watermelon"
842 }
843 }
844 }
845 }
846 args {
847 type: V_DOUBLE
848 v_double: 256.51
849 }
850 }
851
852
853 5 rows affected
854 Rows matched: 5 Changed: 5 Warnings: 0
855 RUN select doc FROM xtest.mycoll
856 doc
857 {"_id": "1", "name": "watermelon", "amount": 256.51}
858 {"_id": "2", "name": "watermelon", "amount": 256.51}
859 {"_id": "3", "name": "watermelon", "amount": 256.51}
860 {"_id": "4", "name": "watermelon", "amount": 256.51}
861 {"_id": "5", "name": "watermelon", "amount": 256.51}
862 0 rows affected
863 Update with Null operator and placeholder
864 send Mysqlx.Crud.Update {
865 collection {
866 name: "mycoll"
867 schema: "xtest"
868 }
869 data_model: DOCUMENT
870 criteria {
871 type: OPERATOR
872 operator {
873 name: "=="
874 param {
875 type: IDENT
876 identifier {
877 document_path {
878 type: MEMBER
879 value: "name"
880 }
881 }
882 }
883 param {
884 type: PLACEHOLDER
885 position: 0
886 }
887 }
888 }
889 operation {
890 source {
891 document_path {
892 type: MEMBER
893 value: "amount"
894 }
895 }
896 operation: ITEM_SET
897 value {
898 type: LITERAL
899 literal {
900 type: V_NULL
901 }
902 }
903 }
904 args {
905 type: V_STRING
906 v_string {
907 value: "watermelon"
908 }
909 }
910 }
911
912
913 5 rows affected
914 Rows matched: 5 Changed: 5 Warnings: 0
915 RUN select doc FROM xtest.mycoll
916 doc
917 {"_id": "1", "name": "watermelon", "amount": null}
918 {"_id": "2", "name": "watermelon", "amount": null}
919 {"_id": "3", "name": "watermelon", "amount": null}
920 {"_id": "4", "name": "watermelon", "amount": null}
921 {"_id": "5", "name": "watermelon", "amount": null}
922 0 rows affected
923 Update with ITEM_REPLACE operator and placeholder
924 send Mysqlx.Crud.Update {
925 collection {
926 name: "mycoll"
927 schema: "xtest"
928 }
929 data_model: DOCUMENT
930 criteria {
931 type: OPERATOR
932 operator {
933 name: "=="
934 param {
935 type: IDENT
936 identifier {
937 document_path {
938 type: MEMBER
939 value: "name"
940 }
941 }
942 }
943 param {
944 type: PLACEHOLDER
945 position: 0
946 }
947 }
948 }
949 operation {
950 source {
951 document_path {
952 type: MEMBER
953 value: "name"
954 }
955 }
956 operation: ITEM_REPLACE
957 value {
958 type: LITERAL
959 literal {
960 type: V_STRING
961 v_string {
962 value: "watermelon_replace"
963 }
964 }
965 }
966 }
967 args {
968 type: V_STRING
969 v_string {
970 value: "watermelon"
971 }
972 }
973 }
974
975
976 5 rows affected
977 Rows matched: 5 Changed: 5 Warnings: 0
978 RUN select doc FROM xtest.mycoll
979 doc
980 {"_id": "1", "name": "watermelon_replace", "amount": null}
981 {"_id": "2", "name": "watermelon_replace", "amount": null}
982 {"_id": "3", "name": "watermelon_replace", "amount": null}
983 {"_id": "4", "name": "watermelon_replace", "amount": null}
984 {"_id": "5", "name": "watermelon_replace", "amount": null}
985 0 rows affected
986 Update with ITEM_REMOVE operator and placeholder
987 send Mysqlx.Crud.Update {
988 collection {
989 name: "mycoll"
990 schema: "xtest"
991 }
992 data_model: DOCUMENT
993 criteria {
994 type: OPERATOR
995 operator {
996 name: "=="
997 param {
998 type: IDENT
999 identifier {
1000 name: "_id"
1001 }
1002 }
1003 param {
1004 type: PLACEHOLDER
1005 position: 0
1006 }
1007 }
1008 }
1009 operation {
1010 source {
1011 document_path {
1012 type: MEMBER
1013 value: "name"
1014 }
1015 }
1016 operation: ITEM_REMOVE
1017 }
1018 args {
1019 type: V_DOUBLE
1020 v_double: 3
1021 }
1022 }
1023
1024
1025 1 rows affected
1026 Rows matched: 1 Changed: 1 Warnings: 0
1027 RUN select doc FROM xtest.mycoll
1028 doc
1029 {"_id": "1", "name": "watermelon_replace", "amount": null}
1030 {"_id": "2", "name": "watermelon_replace", "amount": null}
1031 {"_id": "3", "amount": null}
1032 {"_id": "4", "name": "watermelon_replace", "amount": null}
1033 {"_id": "5", "name": "watermelon_replace", "amount": null}
1034 0 rows affected
1035 Update with ARRAY_APPEND operator and placeholder
1036 send Mysqlx.Crud.Update {
1037 collection {
1038 name: "mycoll"
1039 schema: "xtest"
1040 }
1041 data_model: DOCUMENT
1042 criteria {
1043 type: OPERATOR
1044 operator {
1045 name: "=="
1046 param {
1047 type: IDENT
1048 identifier {
1049 name: "_id"
1050 }
1051 }
1052 param {
1053 type: PLACEHOLDER
1054 position: 0
1055 }
1056 }
1057 }
1058 operation {
1059 source {
1060 document_path {
1061 type: MEMBER
1062 value: "amount"
1063 }
1064 }
1065 operation: ARRAY_APPEND
1066 value {
1067 type: LITERAL
1068 literal {
1069 type: V_STRING
1070 v_string {
1071 value: "Update_ArrayAppend"
1072 }
1073 }
1074 }
1075 }
1076 args {
1077 type: V_DOUBLE
1078 v_double: 3
1079 }
1080 }
1081
1082
1083 1 rows affected
1084 Rows matched: 1 Changed: 1 Warnings: 0
1085 RUN select doc FROM xtest.mycoll
1086 doc
1087 {"_id": "1", "name": "watermelon_replace", "amount": null}
1088 {"_id": "2", "name": "watermelon_replace", "amount": null}
1089 {"_id": "3", "amount": [null, "Update_ArrayAppend"]}
1090 {"_id": "4", "name": "watermelon_replace", "amount": null}
1091 {"_id": "5", "name": "watermelon_replace", "amount": null}
1092 0 rows affected
1093 Update with ITEM_MERGE value and placeholder
1094 send Mysqlx.Crud.Update {
1095 collection {
1096 name: "mycoll"
1097 schema: "xtest"
1098 }
1099 data_model: TABLE
1100 criteria {
1101 type: OPERATOR
1102 operator {
1103 name: "=="
1104 param {
1105 type: IDENT
1106 identifier {
1107 name: "_id"
1108 }
1109 }
1110 param {
1111 type: PLACEHOLDER
1112 position: 0
1113 }
1114 }
1115 }
1116 operation {
1117 source {
1118 name: "doc"
1119 }
1120 operation: ITEM_MERGE
1121 value {
1122 type: LITERAL
1123 literal {
1124 type: V_OCTETS
1125 v_octets {
1126 value: "{\"third\":3.0, \"fourth\": \"four\"}"
1127 }
1128 }
1129 }
1130 }
1131 args {
1132 type: V_UINT
1133 v_unsigned_int: 2
1134 }
1135 }
1136
1137
1138 1 rows affected
1139 Rows matched: 1 Changed: 1 Warnings: 0
1140 RUN select doc FROM xtest.mycoll
1141 doc
1142 {"_id": "1", "name": "watermelon_replace", "amount": null}
1143 {"_id": "2", "name": "watermelon_replace", "third": 3.0, "amount": null, "fourth": "four"}
1144 {"_id": "3", "amount": [null, "Update_ArrayAppend"]}
1145 {"_id": "4", "name": "watermelon_replace", "amount": null}
1146 {"_id": "5", "name": "watermelon_replace", "amount": null}
1147 0 rows affected
1148 RUN insert into mycoll (doc) values ('{"_id": "6", "third": ["two"]}')
1149
1150 1 rows affected
1151 Update with ARRAY_INSERT value and placeholder
1152 send Mysqlx.Crud.Update {
1153 collection {
1154 name: "mycoll"
1155 schema: "xtest"
1156 }
1157 data_model: TABLE
1158 criteria {
1159 type: OPERATOR
1160 operator {
1161 name: "=="
1162 param {
1163 type: IDENT
1164 identifier {
1165 name: "_id"
1166 }
1167 }
1168 param {
1169 type: PLACEHOLDER
1170 position: 0
1171 }
1172 }
1173 }
1174 operation {
1175 source {
1176 document_path {
1177 type: MEMBER
1178 value: "third"
1179 }
1180 document_path {
1181 type: ARRAY_INDEX
1182 index: 0
1183 }
1184 name: "doc"
1185 }
1186 operation: ARRAY_INSERT
1187 value {
1188 type: LITERAL
1189 literal {
1190 type: V_OCTETS
1191 v_octets {
1192 value: "two.1"
1193 }
1194 }
1195 }
1196 }
1197 args {
1198 type: V_UINT
1199 v_unsigned_int: 6
1200 }
1201 }
1202
1203
1204 1 rows affected
1205 Rows matched: 1 Changed: 1 Warnings: 0
1206 RUN select doc FROM xtest.mycoll
1207 doc
1208 {"_id": "1", "name": "watermelon_replace", "amount": null}
1209 {"_id": "2", "name": "watermelon_replace", "third": 3.0, "amount": null, "fourth": "four"}
1210 {"_id": "3", "amount": [null, "Update_ArrayAppend"]}
1211 {"_id": "4", "name": "watermelon_replace", "amount": null}
1212 {"_id": "5", "name": "watermelon_replace", "amount": null}
1213 {"_id": "6", "third": ["two.1", "two"]}
1214 0 rows affected
1215 Delete with == operator and placeholder
1216 send Mysqlx.Crud.Delete {
1217 collection {
1218 name: "mycoll"
1219 schema: "xtest"
1220 }
1221 data_model: DOCUMENT
1222 criteria {
1223 type: OPERATOR
1224 operator {
1225 name: "=="
1226 param {
1227 type: IDENT
1228 identifier {
1229 name: "_id"
1230 }
1231 }
1232 param {
1233 type: PLACEHOLDER
1234 position: 0
1235 }
1236 }
1237 }
1238 args {
1239 type: V_SINT
1240 v_signed_int: 2
1241 }
1242 }
1243
1244
1245 1 rows affected
1246 RUN select doc FROM xtest.mycoll
1247 doc
1248 {"_id": "1", "name": "watermelon_replace", "amount": null}
1249 {"_id": "3", "amount": [null, "Update_ArrayAppend"]}
1250 {"_id": "4", "name": "watermelon_replace", "amount": null}
1251 {"_id": "5", "name": "watermelon_replace", "amount": null}
1252 {"_id": "6", "third": ["two.1", "two"]}
1253 0 rows affected
1254 Delete with != operator and placeholder
1255 send Mysqlx.Crud.Delete {
1256 collection {
1257 name: "mycoll"
1258 schema: "xtest"
1259 }
1260 data_model: DOCUMENT
1261 criteria {
1262 type: OPERATOR
1263 operator {
1264 name: "!="
1265 param {
1266 type: IDENT
1267 identifier {
1268 document_path {
1269 type: MEMBER
1270 value: "name"
1271 }
1272 }
1273 }
1274 param {
1275 type: PLACEHOLDER
1276 position: 0
1277 }
1278 }
1279 }
1280 args {
1281 type: V_STRING
1282 v_string {
1283 value: "Update_<="
1284 }
1285 }
1286 }
1287
1288
1289 3 rows affected
1290 RUN select doc FROM xtest.mycoll
1291 doc
1292 {"_id": "3", "amount": [null, "Update_ArrayAppend"]}
1293 {"_id": "6", "third": ["two.1", "two"]}
1294 0 rows affected
1295 send Mysqlx.Crud.Find {
1296 collection {
1297 name: "mycoll"
1298 schema: "xtest"
1299 }
1300 data_model: DOCUMENT
1301 criteria {
1302 type: OPERATOR
1303 operator {
1304 name: ">"
1305 param {
1306 type: IDENT
1307 identifier {
1308 document_path {
1309 type: MEMBER
1310 value: "name"
1311 }
1312 }
1313 }
1314 param {
1315 type: PLACEHOLDER
1316 position: 1
1317 }
1318 }
1319 }
1320 args {
1321 type: V_OCTETS
1322 v_octets {
1323 value: "Jon"
1324 }
1325 }
1326 }
1327
1328 Got expected error: Invalid value of placeholder (code 5154)
1329 send Mysqlx.Crud.Find {
1330 collection {
1331 name: "mycoll"
1332 schema: "xtest"
1333 }
1334 data_model: DOCUMENT
1335 criteria {
1336 type: OPERATOR
1337 operator {
1338 name: ">"
1339 param {
1340 type: IDENT
1341 identifier {
1342 document_path {
1343 type: MEMBER
1344 value: "name"
1345 }
1346 }
1347 }
1348 param {
1349 type: PLACEHOLDER
1350 position: 1
1351 }
1352 }
1353 }
1354 }
1355
1356 Got expected error: Invalid value of placeholder (code 5154)
1357 ================================================================================
1358 CLEAN UP
1359 ================================================================================
1360 RUN drop schema if exists xtest
1361
1362 1 rows affected
1363 Mysqlx.Ok {
1364 msg: "bye!"
1365 }
1366 ok