Node seed.js error in vidly-api-node - MongoError: Unsupported OP_QUERY command: delete

Mmm I dont think so, I just cloned the repository form moshs github profile, but now that i think i solved this error before Cannot install dependencies for vidfly-api-node - #5 by rollingtatoo22

I’m trying to downgrade the mongo version but it is a little difficult jajaj

1 Like

sorry i have not had time yet to try it. But, i think i tried changing the versions when i got the error and still didnt work, but honestly i was already giving up on it hhaahah, i will try again as soon as i can. Meanwhile, I hope you will find out

1 Like

Well, for me it doesn’t work at all - I was using node v16.16.0, downgrade it to 4.8.7 and then I have different error when using node seed.js:

Strange thing is - I tried to install mongod version 5 and installation ends succesfully, but still mongod --version show me that I’m using version 6.0 o_O

I finally make it worked!!! So - I try to debug it with my coworker and the problem was moongose - according to this docs (Mongoose v6.5.2: MongoDB Version Compatibility) MongoDB with version 6.0 works with mongoose version ^6.5.0. I had version 5.* so this mongo client was not compatible with it. After upgrading mongoose to ^6.5.2 it finally works and I see in compass this vildy db :slight_smile:

2 Likes

Hello, how can I update mongoose ? I’m searching for documentation but I can’t find anything. Sorry if the question is silly

No question is silly :slight_smile: You can just use this in the vidly-ap-node folder:
npm install --save mongoose@6

Unfortunately this works only for letting me seed this file to my Mongo Compass app :confused: I still got new issue with using node index.js :confused: But I try to consult it again.

Thankss, I already solve it, now we are in the same problem again jajajaj

Hey did you solve the other problem? if yes please tell me how

1 Like

vidly-api-node:

Verified with node 14.18.1.

Make the following changes:
In package.json

“bcrypt”: “^5.0.0”
“mongoose”: “^6.5.2”

In rentals.js:

//Fawn.init(mongoose);
Fawn.init(“mongodb://127.0.0.1:27017/vidly”);

rm -rf node_modules
npm i
node seed.js
node index.js

PS:

2 Likes

Works for me - just to clear up: it’s rentals.js in routes folder (there’s similar file rental.js in models and I was confused for a few minutes :D).

1 Like

That’s right. Updated!

Hi
thanks for ur answer. I did all the things you said.
i am able to run seed.js but when i want to run index.js it get this error:
‘SyntaxError: Invalid or unexpected token’
at Fawn.init(“mongodb://127.0.0.1:27017/vidly”);

image

The quotes seem to be incorrect when it is copied from browser and directly pasted into vscode.
Correct the quotes as shown, and it should work.

thank u so much it finally worked!