Exploring my MongoDB repository
import org.springframework.data.mongodb.repository.MongoRepository;
public interface RecordRepository extends MongoRepository<Record, String> {
}
Here is my model:
public class Record {
private long id;
private String cameraid;
@JsonSerialize(using=DateTimeSerial.class)
private DateTime timestamp;
private String filename;
public Record(long id,String cameraid, DateTime timestamp, String filename) {
this.id=id;
this.cameraid = cameraid;
this.timestamp = timestamp;
this.filename = filename;
} //getters and setters
Now, let's take a look at the main controller:
@RequestMapping(value="list") //controller for list
public List<Record> getList() {
List<Record> recordList = rep.findAll();
return recordList;
}
}
Reviewing the data stored in MongoDB:
{"id":1,"cameraid":"001","timestamp":"2016/06/15 15:03","filename":"e997a7321a3d2966802ba466feca69f8"},
{"id":2,"cameraid":"001","timestamp":"2016/06/15 15:03","filename":"63999edc2218f490cd883592fe5d26a1"},
{"id":3,"cameraid":"002","timestamp":"2016/06/15 15:03","filename":"9ba6722aed8aa1aae0e4545ee6d376c3"},
A glimpse at my HTML file structure:
<!DOCTYPE html>
<html ng-app='camListApp'>
...
Further details in the JavaScript file:
var camListApp = angular.module('camListApp', []);
camListApp.controller('Hello', ['$scope', '$http', function($scope, $http){
...
How do I fetch and display specific cameraid data from MongoDB using AngularJS? "http://localhost:8081/camera/list" retrieves all data on the web service. Can anyone assist me with this query?