mongoDB - undefined is not a function Nodejs-Mongodb(AYUDA!!)

 
Vista:
Imágen de perfil de Aniuska

undefined is not a function Nodejs-Mongodb(AYUDA!!)

Publicado por Aniuska (1 intervención) el 13/08/2015 01:32:49
Hola,estoy empezando a usar Nodejs con MongoDB todo iba bien,pero me salta un problema cuando utilizo la funcion err y no encuentro solucion si alguien puede ayudarme:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var express = require('express');
var mongoose = require('mongoose');
var bodyParser= require('body-parser');
 
var app = express();
mongoose.connect("mongodb://localhost/primera_pagina");
 
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
 
 
 
//definir el schema de nuestros productos
var productSchema = {
	title:String,
	description:String,
	ImageURL: String,
	pricing: Number
};
 
var Product = mongoose.model("Product", productSchema);
 
 
app.set("view engine","jade");
 
app.use(express.static("public"));
 
app.get( "/" , function(solicitud,respuesta){
 
respuesta.render("index");
});
app.post("/menu",function(solicitud,respuesta) {
	console.log(solicitud.body);
	var data= {
		title: solicitud.body.title,
		description: solicitud.body.description,
		ImageURL: "data.png",
		pricing:solicitud.body.pricing
	}
	var Product = new Product(data);
	     Product.save(function(err) {
 
		console.log(Product);
	});
 
 
	respuesta.render("menu/new");
});
app.get("/menu/new",function(solicitud,respuesta) {
	respuesta.render("menu/new")
})
 
app.listen(8080);

Gracias!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder