-
Notifications
You must be signed in to change notification settings - Fork 32
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
Manual referencing not resolving #18
Comments
@mingard you are using the browserified lib/index.js which makes it really hard to debug. Is there any chance you can use the src/index.js (requires recent NodeJS with harmony flags or recent Chrome)? |
@mingard you might try making this call right after you start the database: Although, the root problem seems to be that RelatedDocument is not in scope for |
@anywhichway I'll give that a shot. I'm using reasondb on the server with NodeJS 6.9 - is that an issue? |
@mingard not if you are using the BTW, thanks for the paces you are putting reasondb through. |
@anywhichway I'll try with the suggested debug method. Re: Putting reasondb through it's paces, you're very welcome. It is already proving exceptionally performant. |
@mingard There are three reasons for the performance:
|
@anywhichway I tried the hack but it doesn't work for me. I could try and recreate again in a test. When It does exist if the type is I tried defining the second schema in the request on the off chance that would work. class ParentCollection {
}
class ChildCollection {
}
let query = db.select()
.from({$p: ParentCollection, $c: ChildCollection})
.where(where) This didn't force the recognition of the |
@mingard Let us dig in a little more. Since we know where the problem is in the code, it is more a question of figuring out why the scope is wrong than having an example that shows the problem. |
@mingard try calling db.index(ChildCollection) before you call db.select(); If this does not work try adding ChildCollection to the scope of the store you pass to the database, e.g. store.scope["ChildCollection"] = ChildCollection. |
@anywhichway I tried both, in that order and then a combination but still no luck. It does however seem to successfully add the scope key. I had to call an index on the ParentCollection first before it had been added as an index. My script looks like this: db.index(ParentCollection)
db.index(ChildCollection)
ParentCollection.index.store.scope.ChildCollection = ChildCollection And the scope looks like this: { ParentCollection:
{ [Function: ParentCollection]
index:
Index {
saveAsync: true,
keys: {},
store: [Object],
name: 'ParentCollection',
pending: {} } },
ChildCollection:
{ [Function: ChildCollection]
index:
Index {
saveAsync: true,
keys: [Object],
store: [Object],
name: 'ChildCollection',
pending: {} } } } |
@mingard So are you saying your code still fails but the scope is set? |
@anywhichway That's correct. The exact same error occurs. Is there anything I can do to help debug? |
@mingard At this point I think we are going to need a working example of the problem. We know where the bug manifests but not the source of the issue. https://github.com/anywhichway/reasondb/tree/i18 has been pushed with a subdirectory test/issues/18 where you can drop some code. |
@anywhichway Thanks, will do |
@mingard During a code walk through an error was found in JSONBlockStore where it was not updating the scope map. Does this scope issue occur if you use LocalStore? |
@anywhichway I'm not sure - how can I test this? I can tell you that after saving and restarting the app using LocalStore, references are no longer resolved |
@mingard So have we introduced a new error? Or is it that the original error your reported still exists? |
@anywhichway It has been that way since I first tried using LocalStore, which was a long time ago. It was the reason I switched to JSONBlockStore. Nothing new! I meant to raise a ticket - will do this soon. |
@mingard Aha! Thanks. |
Closed for inactivity. We believe the original issue has been resolved in the v1.x.x releases. |
I created a reference within a document body, something like:
Collection: Parent
The intention is to relate one document to another. It works if I reference an
Object
but not a custom type. Error is thrown here with an error similar toThere is a
RelatedDocument
db, and it's populated with a document with that@key
Is there a better way to insert a related document too?
The text was updated successfully, but these errors were encountered: