-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
query using pointers in deep sub-documents #7426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
a7fd0ea
3973c5f
bea4707
61affe2
bfdb6a9
0638e5e
f6a4172
6deb7ec
1069519
3a2afda
d8dc524
770e36f
7df6c02
4e5eba6
c36588e
17cf1a4
d36a53b
682f1bf
05882bc
1594afe
6a39cfe
3efe6f6
5b82047
2ea03da
0e215ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4318,6 +4318,40 @@ describe('Parse.Query testing', () => { | |
} | ||
}); | ||
|
||
it_only_db('mongo')('deeply nested Pointers (issue #7413)', async function (done) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this only a bug in MongoDB, or is this a feature that only works in MongoDB? If the first, then the test should not be exclusively for MongoDB. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really know how PostgreSQL works with parse-server, but I think it must be MongoDB only. How sub-documents work in an SQL db ? |
||
const parent = new Parse.Object('Parent'); | ||
const child1 = new Parse.Object('Child'); | ||
const child2 = new Parse.Object('Child'); | ||
|
||
parent.set('subDocument', { child: child1 }); | ||
parent.set('children', [ | ||
{ child: child1, count: 2 }, | ||
{ child: child2, count: 3 }, | ||
]); | ||
await parent.save(); | ||
|
||
// equalTo | ||
oallouch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const resultsEq = await new Parse.Query('Parent').equalTo('children.child', child1).find(); | ||
expect(resultsEq.length).toBe(1); | ||
|
||
// direct subDocument equalTo | ||
const resultsSubDocument = await new Parse.Query('Parent') | ||
.equalTo('subDocument.child', child1) | ||
.find(); | ||
expect(resultsSubDocument.length).toBe(1); | ||
|
||
// subDocument in | ||
const resultsSubDocumentIn = await new Parse.Query('Parent') | ||
.containedIn('subDocument.child', [child1]) | ||
.find(); | ||
expect(resultsSubDocumentIn.length).toBe(1); | ||
|
||
// containedIn | ||
const results = await new Parse.Query('Parent').containedIn('children.child', [child1]).find(); | ||
expect(results.length).toBe(1); | ||
done(); | ||
}); | ||
|
||
it('include with *', async () => { | ||
const child1 = new TestObject({ foo: 'bar', name: 'ac' }); | ||
const child2 = new TestObject({ foo: 'baz', name: 'flo' }); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please adapt format, see other entries