question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duplicated Presentation when using mongoose

See original GitHub issue

I have a feathers service that I can test with postman, and it shows a list of 4 records all distinct. However, when I try to use it with aor-feathers-client, no matter which model I use, the records are all being presented as equal. So let’s say for example, we have a model for reminders. We would expect:

Reminders List

  • reminder 1
  • reminder 2

But what is appearing is:

Reminder List

  • reminder 1
  • reminder 1

screenshot 2017-07-04 17 33 46

Where the first item is always duplicated. Also, when trying to edit, it simply passes ‘undefined’. I’m not sure what I’m doing wrong here. I based it entirely off of your example:

// App.js

import React from 'react';
import { Admin, Resource, simpleRestClient } from 'admin-on-rest';
import { RemindersList} from './Reminders';
import { restClient } from 'aor-feathers-client'; // authClient for future!
import feathersClient from './feathersClient';

const App = () => (
  <Admin restClient={restClient(feathersClient)}>
    <Resource name="reminders" list={ContactList} />
  </Admin>
);

export default App;

// Contact.js

import React from 'react';
import { Filter, DisabledInput, ReferenceInput, List, Edit, Create, SimpleForm, Datagrid, TextField, SelectInput, TextInput, EditButton } from 'admin-on-rest/lib/mui';

export const RemindersList = (props) => (
    <List {...props}>
        <Datagrid>
            <TextField source="_id" />
            <TextField source="credoId" />
            <TextField source="surveyId" />
            <TextField source="frequency" />
            <TextField source="nextReminder" />
            <EditButton />

        </Datagrid>
    </List>
);

// feathersClient.js

import feathers from 'feathers-client';
import hooks from 'feathers-hooks';
import rest from 'feathers-rest/client';

const host = 'http://localhost:3030';

export default feathers()
  .configure(hooks())
  .configure(rest(host).fetch(window.fetch.bind(window)));

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

0reactions
josxcommented, Jul 11, 2017

It seems to be that you are using mongo or somehting with custom id field name. We are working to support that! @thngdude if you can please help us! here WIP https://github.com/josx/aor-feathers-client/pull/21 (need tests, and @1beb told us that it is not working )

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicate data getting added into collection - MongoDB
Hi, I have created a mongoose model as below, and set recordId field to “unique: true” to handle duplicate entry. But when through...
Read more >
node.js to check out duplication value in mongoose
As you see I need to use count method whether the value is duplicated or not. I don't want to use count method...
Read more >
Handling Mongoose Dublication Errors - DEV Community ‍ ‍
my logic here is when I am using create function I will insert a new option which is some keys to check if...
Read more >
Mongoose v6.8.2: FAQ
A. The most common cause of duplicate queries is mixing callbacks and promises with queries. That's because passing a callback to a query...
Read more >
Mongoose 101: An Introduction to the Basics, Subdocuments ...
Mongoose adds a new character to the database each time you use new Character and save . If you run the code(s) above...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found