You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose we have a javascript object with a inner object that we want to save as a doc in pouchdb . In my case it has more lines and a couple of relationships, but for simplicity :
{
id : "doc1",
name : "Document 1",
props : {
id : 1,
prop1 : "hello",
prop2 : "world"
}
}
In normal pouch, we can put this to save a doc like:
But, if when we try to save with db.rel.save, it only stores the id of object, skipping all other content:
If before call db.rel.save, I do doc.props = [doc.props]; it will be stored as an array with the entire object. It has a big side effect doing this when we retrive in client, console.log($scope.doc) prints all doc correclty (including prop as an array with one object), but doing console.log($scope.doc.props) throws undefined.
So, what's happening when saving an object inside doc? It is the normal behavior?
The text was updated successfully, but these errors were encountered:
This sounds like a bug in relational-pouch. So you're saying if there's an id prop anywhere, then it will remove the object? Definitely a bug; that should only happen if you define a schema.
Suppose we have a javascript object with a inner object that we want to save as a doc in pouchdb . In my case it has more lines and a couple of relationships, but for simplicity :
In normal pouch, we can put this to save a doc like:
But, if when we try to save with db.rel.save, it only stores the id of object, skipping all other content:
If before call db.rel.save, I do doc.props = [doc.props]; it will be stored as an array with the entire object. It has a big side effect doing this when we retrive in client, console.log($scope.doc) prints all doc correclty (including prop as an array with one object), but doing console.log($scope.doc.props) throws undefined.
So, what's happening when saving an object inside doc? It is the normal behavior?
The text was updated successfully, but these errors were encountered: