1632
Points
Questions
17
Answers
49
-
Asked on January 21, 2019 in MongoDB.
- 9087 views
- 13 answers
- 0 votes
-
Asked on January 11, 2019 in MongoDB.
Choice 1:
To begin the console and execute this:
db.version()
Choice 2:
To open a shell console and do:
$ mongod --version
To show like this one:
$ mongod --version db version v3.0.2
- 456 views
- 3 answers
- 0 votes
-
Asked on January 11, 2019 in MongoDB.
You can using the following code:
collection.find({}, {"sort" : ['datefield', 'asc']} ).toArray(function(err,docs) {});
- 444 views
- 3 answers
- 0 votes
-
Asked on January 11, 2019 in MongoDB.
You should manually create a data folder for after installing the MongoDB.
By default MongoDB will store data in /data/db, but it won't automatically create that directory. To create it, do: $ sudo mkdir -p /data/db/ $ sudo chown `id -u` /data/db You can also tell MongoDB to use a different data directory, with the --dbpath option.
For further information go to MongoDB wiki page.
- 377 views
- 3 answers
- 0 votes
-
Asked on January 8, 2019 in MongoDB.
You can use your collection:
db.collection.getIndexes()
http://docs.mongodb.org/manual/administration/indexes/#information-about-indexes
- 416 views
- 3 answers
- 0 votes
-
Asked on January 8, 2019 in MongoDB.
You can do this one:
BasicDBObject doc = new BasicDBObject( "name", "Matt" ); collection.insert( doc ); ObjectId id = (ObjectId)doc.get( "_id" );
- 769 views
- 3 answers
- 0 votes
-
Asked on January 8, 2019 in MongoDB.
This is a API structure of mongoose.model:
Mongoose#model(name, [schema], [collection], [skipInit])
The following statement is What mongoose do is that, When no collection argument is passed, The Mongoose produces a collection name by pluralizing the model name. If you don’t like this behavior, either pass a collection name or set your schemas collection name option.
For the example:
var schema = new Schema({ name: String }, { collection: 'actor' });
Or Else
schema.set('collection', 'actor')
Or Else
var collectionName = 'actor' var M = mongoose.model('Actor', schema, collectionName);
- 562 views
- 3 answers
- 0 votes
-
Asked on January 8, 2019 in MongoDB.
You only toll the documents with sent_at defined with a value of null (don’t count the documents with sent_at not set):
db.emails.count({sent_at: { $type: 10 }})
- 415 views
- 3 answers
- 0 votes
-
Asked on January 8, 2019 in MongoDB.
The version of Mongo 2.2, To add a field multiplex and set it to true
db.Collection.update({query}, {$set: {field1: "f1", field2: "f2"}}, {multi: true })
- 395 views
- 3 answers
- 0 votes
-
Asked on January 8, 2019 in MongoDB.
It isn’t must related to MongoDB. the language on computer B was not defined correctly. so i will fix it by typing.
sudo locale-gen en_US en_US.UTF-8
sudo locale-gen it_IT it_IT.UTF-8
sudo locale-gen xx_xx xx_XX.UTF-8 …
sudo dpkg-reconfigure localesThe command make a configure that the needed locales. After those steps mongorestore got back working as usual.
- 368 views
- 3 answers
- 0 votes