Query for Sub Document field in Spring Data Mongodb

To resolve this ambiguity you can use _ inside your method name to manually define traversal points. So our method name would end up like so:

References http://docs.spring.io/spring-data/data-mongo/docs/current/reference/html/#repositories.query-methods.query-property-expressions https://stackoverflow.com/questions/26887505/spring-data-mongodb-query-for-subdocument-field

Read More

Spring Data MongoDB – Indexes, Annotations and Converters

Indexed This annotation marks the field as indexed in MongoDB

Compound Indexes MongoDB supports compound indexes, where a single index structure holds references to multiple fields.

Transient As you would expect, this simple annotation excludes the field from being persisted in the database.

Field @Field indicates the …

Read More

Spring Data MongoDB : Query document

Test Data

BasicQuery example

findOne example

find and $inc example

find and $gt, $lt, $and example

You can’t use Criteria.and() to add multiple criteria into the same field, to fix it, use Criteria.andOperator(), see updated example :

find and sorting example

find and …

Read More

Install MongoDB on OpenSuse

after install run

the restart service and run with config

other commands

References https://docs.mongodb.com/v3.0/reference/configuration-options/ http://stackoverflow.com/questions/23943651/mongodb-admin-user-not-authorized http://stackoverflow.com/questions/35881662/mongodb-error-not-authorized-to-execute-command https://docs.mongodb.com/manual/tutorial/enable-authentication/ http://stackoverflow.com/questions/23003391/how-do-i-add-an-admin-user-to-mongo-in-2-6

Read More

Sessions in Express.js

Setting Session Variables

Reading Session Variables

Updating Session Variables

Deleting Session Variables

Deleting a Session

References http://expressjs-book.com/index.html%3Fp=128.html https://github.com/expressjs/session https://github.com/jdesboeufs/connect-mongo

Read More

Remove values from an existing array in MongoDB



References https://docs.mongodb.com/manual/reference/operator/update/pull/#pull http://stackoverflow.com/questions/16959099/how-to-remove-array-element-in-mongodb

Read More

Install MongoDB as Windows Service

create a file at C:\mongodb\mongod.cfg

Install the MongoDB service

Start the MongoDB service

Stop or remove the MongoDB service as needed

References : https://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/

Read More