These are chat archives for Automattic/mongoose

15th
Apr 2018
Héctor F. Jiménez.
@h3ct0rjs
Apr 15 2018 18:24
Hi tech community, actually I'm reading the documentation provided at http://mongoosejs.com/docs/guide.html, but When I click
in any given url for example to get the info about string schema it always goes to the same page.... http://mongoosejs.com/docs/api.html#schema-string-js, date http://mongoosejs.com/docs/api.html#schema-date-js and so on.... Is there any problem there or what should I look. Thanks in advance
Hector
Kev
@lineus
Apr 15 2018 18:38
Hi @h3ct0rjs if you find broken links in the docs, you can open an issue here, or submit a pull request here with a fix. The contribution guide is here
There's a documentation section in the contribution guide that points you in the right direction.
Héctor F. Jiménez.
@h3ct0rjs
Apr 15 2018 18:41
I'll check that :smile: thank you
I'd prefer to open an issue :shipit:
Oliver Williams
@o-t-w
Apr 15 2018 18:45
I am getting the error "not authorized on admin to execute command" :worried:
const mongoose = require('mongoose');
mongoose.connect('<redacted>', function(error) {
  if (error) {
    console.log(error)
  }
  else {
    console.log('connected to mongo atlas!!');
  }
});

const Schema = mongoose.Schema, ObjectId = Schema.ObjectId;

const PostSchema = new Schema({
  tags: Array,
  text: String,
  date: {
    type: Date,
    default: Date.now
}
});

var Post = mongoose.model('Post', PostSchema);

var sillyUpdate = new Post ({text: 'blah blah'})

sillyUpdate.save(function(error) {
  if (error) throw error;
  console.log('post successfully saved!');
})
Kev
@lineus
Apr 15 2018 18:46
@o-t-w you can throw those tildes on their own line to make that prettier :)
shift-enter is your friend
@o-t-w did you create your own connection string? or get it from the atlas console?
Oliver Williams
@o-t-w
Apr 15 2018 18:48
from the Atlas console. In the security tab I gave the user readwrite access
Kev
@lineus
Apr 15 2018 18:50
if you're looking at the clusters view there should be a button on the right hand side that says connect. if you click that is your node server ip in the white list?
@o-t-w ^
Oliver Williams
@o-t-w
Apr 15 2018 18:53
I was lazy and clicked the button that said whitelist all ip addresses
Kev
@lineus
Apr 15 2018 18:53
oh ok
what version of mongoose are you using?
Oliver Williams
@o-t-w
Apr 15 2018 18:54
^5.0.14
Kev
@lineus
Apr 15 2018 18:54
does your uri have mongodb+srv://... ?
Oliver Williams
@o-t-w
Apr 15 2018 18:55
It has mongodb+srv://username:password@cluster0-1ezm9.mongodb.net/test except the username is my username and the password is my password
Kev
@lineus
Apr 15 2018 18:56
mongoose won't support that version of connection string until the next patch release.
if you go back to the connect button in the cluster view and select 'Connect Your Application' under step 2
choose 'I am using driver 3.4 or earlier instead of 3.6'
the mongodb folks just added the new mongodb+srv connection string to the native js driver a couple of weeks ( or less ) ago. A driver bump will be a part of the 5.0.15 release whenever that happens.
Oliver Williams
@o-t-w
Apr 15 2018 18:59
:star2: That worked! THANKYOU
Kev
@lineus
Apr 15 2018 19:00
:smile: