All Questions
18 questions
1
vote
1
answer
63
views
Trying to seed to mongoDB with an array of string, not sure what I am supposed to declare the model as
So I am trying to test some seed data, with mongoDB, it is an ecommerce store and I am trying to parse in an array of categories but it gives an error. This is the products model
const { Schema, model ...
0
votes
0
answers
204
views
How to seed data into Mongo database with mongoose
I realize this should probably be pretty straightforward but I am hoping someone could point me in the right direction. I am building a schema with mongoose, and I want the schema to have some default ...
0
votes
1
answer
55
views
How do I create 100 items and save to mongo db database
this is the code for creating a new item but how do I create 100 items
this is the code image
1
vote
1
answer
365
views
How to seed a database only when there is no documents in the database using mongoose
I have a seeder function that will seed data into a database. I also have the seeder run when the app starts. Now I am seeding repeated data. How do I modify my function so that it only seeds the ...
1
vote
1
answer
835
views
Error while seeding mongodb using mongoose-seed
I have model schema in ./model.js file
const ImageSchema = new mongoose.Schema(
{
name: { type: String },
filePath: { type: String },
},
{ timestamps: true }
);
module.exports = ...
0
votes
1
answer
2k
views
React.js fetch method on my api is not working?
I am trying to do a simple fetch request from a database hosted on a local server and also I am connected to mongodb in the backend, it seems like something is going wrong with my fetch method. I am ...
2
votes
2
answers
841
views
Getting error Generic type 'InsertWriteOpResult<TSchema>' requires 1 type argument(s) in mongoseeding libraray
I am using mongo-seeding version 3.3 . When i am trying to build the project it is giving me below error
[email protected] serve /app npm run build && tsc && node lib/server.js
node_ts@...
0
votes
2
answers
770
views
Automatic Random Test Data Generation of Documents for Seeding a MongoDB Database
I'm using JSON Generator https://next.json-generator.com to seed my MongoDB database. I'm finding trouble to generate a random set (from one to six) of colors out of the predefined group.
I've ...
-2
votes
2
answers
2k
views
MongoDB seed script for 10million entries takes 30 minutes
I have a project im working on and I have to seed a database with 10 million random rows, which i have successfully done. However it takes about 30 minutes for it to complete, which is expected, but i ...
0
votes
1
answer
4k
views
Seed MongoDB Data
The function below adds data to the database, to the Food collection, only if the collection foods is equal to zero. The idea is to be able to only seed the database once.
This is working perfectly. ...
-1
votes
1
answer
2k
views
Seeding mongoDB data in node.js by referencing ObjectId
i'm using mongoose-data-seed to seed data into mongodb, however it has no mechanism to allow passing of ObjectId() as references to other seed files
2
votes
2
answers
2k
views
MongooseError: Cast to ObjectID failed for value on reading json for db seed
I have a model scheme with a reference field like this:
const UserSchema = new mongoose.Schema({
// ...
uf:{
type: mongoose.Schema.Types.ObjectId, ref: 'UF', index: true
},
});
And my test ...
0
votes
1
answer
968
views
How to seed MongoDb with username/password data?
I created an app using MongoDB, NodeJS, Express.
I am using passport-local-mongoose for user authentication. Thus my users collection has:
* username
* password
* Salt
* Hash
Basically I created a ...
0
votes
1
answer
1k
views
populate a json file
I'm trying to populate a json file with some fake seed data for a User db collection:
Here is how i'm writing to the json file:
Generate json file
Here is what I get as output in the User.json file:
...
2
votes
1
answer
3k
views
How to seed dependent data in Node/MongoDB
I am trying to seed a MongoDB database with a one-to-many relationship using objectID's. Something like the following:
var postSchema = mongoose.Schema({
name: {type: String, required: true, unique:...