Skip to content
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

RxDBSchemas array of string #50

Closed
Tobino opened this issue Feb 10, 2017 · 4 comments
Closed

RxDBSchemas array of string #50

Tobino opened this issue Feb 10, 2017 · 4 comments

Comments

@Tobino
Copy link

Tobino commented Feb 10, 2017

Hi everyone,

When we are using an array of string, RXDB's collection return a wrong array.

Example:

['abc','8'] => [{0:'a',1:'b',2:'c'},{0:'8'}]

while we are expecting the same array.

example of schema:

{
  "type": "object",
  "properties": {
    "likes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  }
}
@pubkey
Copy link
Owner

pubkey commented Feb 10, 2017

@Tobino I don't really get what the first example-code does/should do.
Can you make an example where rxdb is involved and how you insert/fetch documents?

@Tobino
Copy link
Author

Tobino commented Feb 10, 2017

Example with rxdb :

var mySchema = {
	title: 'hero schema',
	description: 'describes a simple hero',
	type: 'object',
	properties: {
		likes: {
			type: 'array',
			items: {
				type: 'string'
			}
		}
	}
};

RxDB.create('heroesDB', 'fruitdown')      // create database
	.then(function (db) { return db.collection('mycollection', mySchema); }) // create collection
	.then(function (collection) {
		collection.insert({likes: ['abc', '8']});
		collection
			.find()
			.$ // <- returns observable of query
			.subscribe(docs => {
				if (docs) {
					console.dir(docs);
				}
			});
	});

And console.dir

{
   likes: [
      {0:'a',1:'b',2:'c'},
      {0:'8'}
   ]
}

Do you think fruitdown could be involved ?

@salomonelli
Copy link
Contributor

Fixed with this PR.

pubkey added a commit that referenced this issue Feb 10, 2017
@pubkey
Copy link
Owner

pubkey commented Feb 12, 2017

Fixed in version 2.0.4. Please upgrade.

@pubkey pubkey closed this as completed Feb 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants